Maher Mahouachi Maher Mahouachi - 3 months ago 37
JSON Question

Send JSON data from express to html NodeJS

Hello all i'm new with node so here my use case i want to post data to my express app and show it on a html page is that possible with nodeJs ?

Here my code'/', function(req, res){
res.sendFile(__dirname + '/views/index.html', {data: req.body});


There are many tutorials showing how to do that. I would recommend first you understand how HTTP protocol works (The message structure : Then go dive into node and exchange data through requests and responses. I'd recommend body-parser to arrange the data format between the two sides. Also read the express documentation. Hope it helps.