tspace-spear
Version:
tspace-spear is a lightweight, high-performance API framework for Node.js that leverages the native HTTP server and supports uWebSockets.js (C++) for maximum speed and efficiency.
2 lines (1 loc) • 385 B
TypeScript
export declare const MiddlewareTemplate = "\nimport { type T } from \"tspace-spear\";\n\nconst sleep = async (ms : number) => new Promise(resolve => setTimeout(resolve, ms))\n\nexport const LogMiddleware = async (ctx : T.Context, next: T.NextFunction) =>{\n await sleep(100);\n console.log('after logging middleware Meow!');\n ctx.req.cat = 'Meow!';\n return next()\n}\n";