const express = require('express');
const List = require('../models/list');
const Crud = require('./crud');
const list = new Crud(List, { queryKey: 'publicId' });
const router = express.Router();
module.exports = router;
router.get('/', list.find(), (req, res) => res.jsonp(req.result));
router.post('/', list.create(), (req, res) => res.jsonp(req.result));
router.get('/:publicId', list.findOne(), (req, res) => res.jsonp(req.result));
router.put('/:publicId', list.update(), (req, res) => res.jsonp(req.result));
// TODO: router.delete('/:publicId', list.delete());
Obviously you'll need to add security layer!