mirror of
https://github.com/sergeyyarkov/asu_tools_service.git
synced 2026-10-11 10:29:22 +03:00
13 lines
393 B
JavaScript
13 lines
393 B
JavaScript
/** @type {HTTPResponse} */
|
|
export default {
|
|
res: null,
|
|
sendJson(data, statusCode = 200) {
|
|
this.res.writeHead(statusCode, { "content-type": "application/json" });
|
|
return this.res.end(JSON.stringify(data, null, 2));
|
|
},
|
|
sendText(text, statusCode = 200) {
|
|
this.res.writeHead(statusCode, { "content-type": "text/plain; charset=utf-8" });
|
|
return this.res.end(text);
|
|
},
|
|
};
|