Answer the question
In order to leave comments, you need to log in
Why is there no data assignment in nodejs?
var express = require('express');
var fs = require('fs');
var app = express();
app.get('/', function (req, res) {
let json = {};
fs.readFile('user.json', function (err, data) {
json += data.toString();
});
res.json(json);
});
app.listen(8000, function () {
console.log('Server Run!');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question