flame/routes/queries.js
2022-03-24 14:48:10 +01:00

29 lines
539 B
JavaScript

const express = require('express');
const router = express.Router();
// middleware
const { auth, requireAuth, requireBody } = require('../middleware');
const {
getQueries,
addQuery,
deleteQuery,
updateQuery,
} = require('../controllers/queries/');
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;