Docs
Routing

Routing

zely.js automatically generates routes based on your file tree of pages.

filenameresult(path)
/index.ts/
/hello.ts/hello
/foo/bar.ts/foo/bar
/user/[id].ts/user/:id
/user/[id]/about.ts/user/:id/about
/foo/[...bar]/foo/:bar*

#Route Parameters

You can access the current page parameters by ctx.params.

Typescript
// pages/user/[id].ts
import type { Context } from 'zely';
 
export function get(ctx: Context) {
  ctx.send({ id: ctx.params.id });
}