NodeJS JSON -Daten servieren
// UPDATE
app.put('/users/:id', (req, res) => {
readFile(data => {
// add the new user
const userId = req.params['id'];
data[userId] = req.body;
writeFile(JSON.stringify(data, null, 2), () => {
res.status(200).send(`users id:${userId} updated`);
});
}, true);
});
Zaw Xtut