elysia-routing
v1.0.0
Published
Declarative routing for Elysia that turns simple definitions into clean predictable routes.
Maintainers
Readme
Why Elysia Routing?
Stop manually registering routes. elysia-routing scans your file structure and automatically creates routes based on filenames. Add type-safe validation with zero dependencies, keep your codebase organized, and scale without the boilerplate.
Installation
# Using Bun
bun add elysia-routing# Using NPM
npm install elysia-routing# Using Yarn
yarn add elysia-routingSupported Conventions
Examples
import { defineRoute } from "elysia-routing"
export default defineRoute({
handler: () => ({ message: "Hello World" })
})import { defineRoute, v } from "elysia-routing"
export default defineRoute({
schema: {
params: v.object({
id: v.string()
})
},
handler: ({ params }) => ({
user: { id: params.id }
})
})import { defineRoute, v } from "elysia-routing"
export default defineRoute({
schema: {
body: v.object({
name: v.string().min(3),
email: v.string().regex(/^[^\s@]+@[^\s@]+\.[^\s@]+$/),
age: v.number().min(18)
})
},
handler: ({ body }) => ({
created: body
})
})