We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6c8f1f commit 6e6d46cCopy full SHA for 6e6d46c
server.js
@@ -23,14 +23,14 @@ app.use(bodyParser.json());
23
app.use(bodyParser.urlencoded({extended: true}));
24
25
app.get('/comments.json', function(req, res) {
26
+ comments = JSON.parse(fs.readFileSync('_comments.json'));
27
res.setHeader('Content-Type', 'application/json');
28
res.send(JSON.stringify(comments));
- comments = JSON.parse(fs.readFileSync('_comments.json'));
29
});
30
31
app.post('/comments.json', function(req, res) {
32
comments.push(req.body);
33
- fs.writeFile('_comments.json', JSON.stringify(comments))
+ fs.writeFile('_comments.json', JSON.stringify(comments));
34
35
36
0 commit comments