22 lines
404 B
JavaScript
22 lines
404 B
JavaScript
function notFound(res) {
|
|
res.statusCode = 404;
|
|
res.end('Not Found');
|
|
}
|
|
|
|
function methodNotAllowed(res) {
|
|
res.statusCode = 405;
|
|
res.end('Method Not Allowed');
|
|
}
|
|
|
|
function sendResponse(res, statusCode, data) {
|
|
res.setHeader("Content-Type", "application/json");
|
|
res.statusCode = statusCode;
|
|
res.end(JSON.stringify(data));
|
|
}
|
|
|
|
module.exports = {
|
|
notFound,
|
|
methodNotAllowed,
|
|
sendResponse
|
|
}
|