summaryrefslogtreecommitdiff
path: root/src/api/reply.ts
blob: e47fc85b9b9094fe99b5acca9883c4f0e126be65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);
	}
};