flame/routes/queries.js

30 lines
539 B
JavaScript
Raw Normal View History

const express = require('express');
const router = express.Router();
// middleware
2022-03-24 13:48:10 +00:00
const { auth, requireAuth, requireBody } = require('../middleware');
const {
getQueries,
addQuery,
deleteQuery,
2021-10-11 11:55:53 +00:00
updateQuery,
} = require('../controllers/queries/');
2022-03-24 13:48:10 +00:00
router
.route('/')
.post(
auth,
requireAuth,
requireBody(['name', 'prefix', 'template']),
addQuery
)
.get(getQueries);
router
.route('/:prefix')
.delete(auth, requireAuth, deleteQuery)
.put(auth, requireAuth, updateQuery);
module.exports = router;