send/server/routes/params.js

16 lines
317 B
JavaScript
Raw Normal View History

2017-11-30 21:41:09 +00:00
const storage = require('../storage');
2018-02-06 22:31:18 +00:00
module.exports = function(req, res) {
2017-11-30 21:41:09 +00:00
const dlimit = req.body.dlimit;
if (!dlimit || dlimit > 20) {
return res.sendStatus(400);
}
try {
2018-02-06 22:31:18 +00:00
storage.setField(req.params.id, 'dlimit', dlimit);
2017-11-30 21:41:09 +00:00
res.sendStatus(200);
} catch (e) {
res.sendStatus(404);
}
};