Introduce processor
This commit is contained in:
parent
68ce6d5748
commit
90f8fe7e53
582 changed files with 246 additions and 188 deletions
13
src/server/api/reply.ts
Normal file
13
src/server/api/reply.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import * as express from 'express';
|
||||
|
||||
export default (res: express.Response, x?: any, y?: any) => {
|
||||
if (x === undefined) {
|
||||
res.sendStatus(204);
|
||||
} else if (typeof x === 'number') {
|
||||
res.status(x).send({
|
||||
error: x === 500 ? 'INTERNAL_ERROR' : y
|
||||
});
|
||||
} else {
|
||||
res.send(x);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue