Initial commit 🍀
This commit is contained in:
13
src/api/reply.ts
Normal file
13
src/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);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user