UNPKG

tspace-spear

Version:

tspace-spear is a lightweight API framework for Node.js that is fast and highly focused on providing the best developer experience. It utilizes the native HTTP server

16 lines 638 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StatusCode = void 0; const StatusCode = (statusCode) => { return (target, key, descriptor) => { const originalMethod = descriptor.value; statusCode = statusCode < 100 ? 100 : statusCode > 599 ? 599 : statusCode; descriptor.value = async function (ctx, next) { ctx.res.writeHead(statusCode, { 'Content-Type': 'application/json' }); return await originalMethod.call(this, ctx, next); }; return descriptor; }; }; exports.StatusCode = StatusCode; //# sourceMappingURL=statusCode.js.map