-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (30 loc) · 862 Bytes
/
index.js
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
26
27
28
29
30
31
32
33
module.exports = function gone({status=410, redirect, type, render, renderLocals, send} = {}) {
if ( redirect ) {
return (req, res, next) => {
res.redirect(status, redirect);
};
}
if ( render ) {
if ( type ) {
return (req, res, next) => {
res.status(status).type(type).render(render, renderLocals);
}
}
return (req, res, next) => {
res.status(status).render(render, renderLocals);
};
}
if ( send ) {
if ( type ) {
return (req, res, next) => {
res.status(status).type(type).send(send);
}
}
return (req, res, next) => {
res.status(status).send(send);
}
}
return (req, res, next) => {
res.sendStatus(status);
};
};