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) • 923 B
TypeScript
export declare const AppTemplate = "\nimport Spear from \"tspace-spear\";\n\nconst app = new Spear({\n logger: true,\n controllers: {\n folder: `${__dirname}/modules/*`,\n name: /controller\\.(ts|js)$/i,\n\n // don't forget to set this option for auto-generate route metadata for type-safe E2E usage, \n // and swagger documentation. By default if use .useSwagger() in app no need to set any description\n preRouteTypes: true\n }\n})\n\napp.cors({\n origins: [ \n /^http:\\/\\/localhost:\\d+$/ \n ],\n credentials: true\n});\n\napp.useGlobalPrefix(\"api\");\napp.useSwagger();\napp.useBodyParser();\n\napp.listen(8000 , ({ port , server }) => {\n console.log(`Server listening on : http://localhost:${port}`)\n console.log(`Docs listening on : http://localhost:${port}/api/docs`)\n});\n\ntype AppRouter = typeof app.contract;\n\nexport { AppRouter };\nexport { app };\nexport default app;\n";