javascript - Sending a JSON file to Express server using JS - Stack Overflow

PHOTO EMBED

Sat Aug 08 2020 04:13:10 GMT+0000 (Coordinated Universal Time)

Saved by @rdemo #javascript

const data = require('/path/to/data.json')

app.get('/search', function (req, res) {
  res.header("Content-Type",'application/json');
  res.send(JSON.stringify(data));
})
content_copyCOPY

https://stackoverflow.com/questions/44849082/sending-a-json-file-to-express-server-using-js