How is it possible to send a variable from the Server Side to the Client Side in Node.JS?
I have an app.js file and a public directory which holds an index.html template.
The app.js uses a basic server and the readFile
function to open and display the HTML template.
The problem is I want to display a MongoDB query result on the client side in index.html
How is this possible, without the use of a framework such as Express, as I am trying to avoid that.
Thanks.
You can either do string replacing yourself or use a template engine which is mostly optimized for doing this.
Template engines: https://github.com/joyent/node/wiki/Modules#wiki-templating