Question: I'm trying to build a Meteor app, which lets users embed a widget on their website, but am having trouble with the widget part.

The user can embed the following code on their website:

```
<div id="example-widget" data-widgetid="SOME WIDGET ID"></div>
<script src="http://localhost:3000/lib/connect.js" async></script>

```

In the connect.js file, I get the required widget data from the server/database, using a Meteor Method, but am not sure how to then mount that data to the div element on the user's website...

Here is my configure.js file: 

```
if (Meteor.isClient) {
    const data = A METEOR METHOD WHICH GETS WIDGET DATA FROM DATABASE;
    const element = document.getElementById('example-widget');
    // I'd like to somehow mount the 'data' to the 'element'
}

```

The element variable returns null - I'm assuming because 'document' refers to my own app, rather than the user's website, where the div was inserted...

Wouldn't be surprised if it's something quite obvious, but I can't seem to get it...

TIA

Answer: 
Here is How I am doing it.

At server.js, 

Exposing API endpoint via **nimble:restivus** then consuming API via **fetch** in client-side widget.

```
Api.addRoute('code/', {
  authRequired: false
}, {
  get() {
    return Orders.findOne({});
  }
});

```
In case anyone is interested - after playing around with the app, all I had to do was move the .js file into the 'public' folder and get rid of the "if (Meteor.isClient)" bit.