-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpatchUnset.js
More file actions
25 lines (23 loc) · 877 Bytes
/
patchUnset.js
File metadata and controls
25 lines (23 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import express from 'express'
const router = express.Router()
//This controller will handle all MongoDB interactions.
import controller from '../db-controller.js'
import auth from '../auth/index.js'
import rest from '../rest.js'
router.route('/')
.patch(auth.checkJwt, controller.patchUnset)
.post(auth.checkJwt, (req, res, next) => {
if (!rest.checkPatchOverrideSupport(req, res)) {
res.statusMessage = 'Improper request method for updating, please use PATCH to remove keys from this object.'
res.status(405)
next(res)
return
}
controller.patchUnset(req, res, next)
})
.all((req, res, next) => {
res.statusMessage = 'Improper request method for updating, please use PATCH to remove keys from this object.'
res.status(405)
next(res)
})
export default router