We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to compose routes and not use multidimensional nesting
import http from 'node:http'; import { createServerAdapter } from '@whatwg-node/server'; import { Elysia, t } from 'elysia'; import { swagger } from '@elysiajs/swagger'; const setup = (app: Elysia) => app.use( swagger({ path: '/docs', provider: 'swagger-ui', }) ); // Dont work const router = new Elysia({ prefix: '/:accountId', name: 'account-router', }).guard({ headers: t.Object({ 'x-remote-user': t.String({ title: 'Remote User', description: '...' }), }), }); // Dont provide headers schema router.get('/', ({ headers }) => { return { from: headers['x-remote-user'], }; }); // Work const router2 = new Elysia({ prefix: '/v2/:accountId', name: 'account-router', }).guard( { headers: t.Object({ 'x-remote-user': t.String({ title: 'Remote User', description: '...', }), }), }, // Its ok provided (app) => app.get('/', ({ headers }) => { return { from: headers['x-remote-user'], }; }) ); const app = new Elysia().use(setup).use(router).use(router2); const adapter = createServerAdapter(async (request) => { return app.handle(request); }); http.createServer(adapter).listen(3000);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I would like to compose routes and not use multidimensional nesting
The text was updated successfully, but these errors were encountered: