add API for list creation
This commit is contained in:
parent
c3cf46a717
commit
51dd7938ef
1 changed files with 24 additions and 0 deletions
|
@ -41,6 +41,30 @@ router.all('/*', (req, res, next) => {
|
|||
|
||||
});
|
||||
|
||||
router.post('/listadd', (req, res) => {
|
||||
let input = {};
|
||||
Object.keys(req.body).forEach(key => {
|
||||
input[(key || '').toString().trim().toUpperCase()] = (req.body[key] || '').toString().trim();
|
||||
});
|
||||
|
||||
lists.create(req.body, (err, id) => {
|
||||
if (err || !id) {
|
||||
log.error('API', err);
|
||||
res.status(500);
|
||||
return res.json({
|
||||
error: err.message || err,
|
||||
data: []
|
||||
});
|
||||
}
|
||||
res.status(200);
|
||||
res.json({
|
||||
data: {
|
||||
id
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
router.post('/subscribe/:listId', (req, res) => {
|
||||
let input = {};
|
||||
Object.keys(req.body).forEach(key => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue