Sunday 28 June 2020

Displaying node variable in browser

I have a Node js module that exports some data:module.jsmodule.exports = { data: "success!" }; My ultimate goal is to display this data in my browser. I have tried using Browserify to bundle the following js file:test.jsconst mod = require('./module') var data = mod.data; console.log(data); I bundle this to get bundle.js, then in my HTML file I have:index.html data:
"success!" is being logged to console, but I want it to be displayed on the browser. Any idea why the variable data is not recognized in my HTML page?

Submitted June 29, 2020 at 01:17AM by sphygmomanometer_

No comments:

Post a Comment