Browser example : How to bundle the 'dgraph-js-http' lib in an HTML page

Posted by hubyhuby:

http1.zip

There is an example for Node.js on server side that is working well.

Now when you want to test it on the browser side the require directive is not reconised by the JS on the browser side. " const dgraph = require(“dgraph-js-http”); " gives an error.

I manage to use a "bundler " and got to the next series of problems :wink:
Could you please provide with an example ?

This worked a little :
browserify index-promise.js > bundle.js

hubyhuby commented :

paulftw commented :

We have a detailed blog post on this topic: https://blog.dgraph.io/post/building-todo-list-react-dgraph/