class Cooed
implements CooedRouter
a simple api server
a simple api server
import { Cooed } from '@cooed/cooed-router' const app = new Cooed() // define endpoints app.get('/', (ctx) => ctx.text('Hello world')) // define grouping route const grouping = app.group('/group') grouping.get('/', ctx => ctx.response.text('This is a group route')) // define route with params grouping.get('/dev/:devId', ctx => ctx.response.json(ctx.request.params.devId)) // with Deno Deno.serve((req) => app.serve(req))
private
_getResponse(handlers: RequestHandler[],ctx: RequestCtx,): Response | Promise<Response>
private
_labelingAPIRoutes(): void
delete<Path extends string>(path: Path,...handlers: RequestHandler<Path>[],): void
get<Path extends string>(path: Path,...handlers: RequestHandler<Path>[],): void
group(prefix: string,middleware?: RequestHandler,): CooedRouter
patch<Path extends string>(path: Path,...handlers: RequestHandler<Path>[],): void
post<Path extends string>(path: Path,...handlers: RequestHandler<Path>[],): void
put<Path extends string>(path: Path,...handlers: RequestHandler<Path>[],): void