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
Get method from filename (eg (post).ts is a POST method), otherwise use GET method.
(post).ts
Example of implementation:
// src/index.ts // file = 'user/(post).ts' const matchedFile = file.match(/\/?\((.*?)\)/) console.log(matchedFile) // [ // '(post)', // 'post', // index: 4, // input: 'user/(post).ts', // groups: undefined // ] const method = matchedFile ? matchedFile[1] : 'get' console.log(method) // post // DRAFT if (typeof importedValue === "function") if (importedValue.length > 0) plugin.group(url, groupOptions, app[method]('', importedValue)); else plugin.group(url, groupOptions, (app) => app[method]('', importedValue())); else if (importedValue instanceof Elysia) plugin.group(url, groupOptions, (app) => app.use(app[method]('', importedValue))));
The route file:
// user/(post).ts import type { ElysiaApp } from "app" export default (() => ({ hello: "world" })) satisfies Parameters<ElysiaApp["post"]>[1]
// routes/getBody.ts import type { ElysiaApp } from "app" export default (({ body }) => { return { body } }) satisfies Parameters<ElysiaApp["get"]>[1]
The text was updated successfully, but these errors were encountered:
Good idea but with this we will forced to introduce new way of autorouting
Because for now we use group(app => ...)
Sorry, something went wrong.
No branches or pull requests
Get method from filename (eg
(post).ts
is a POST method), otherwise use GET method.Example of implementation:
The route file:
Examples
The text was updated successfully, but these errors were encountered: