Skip to main content
Home
This package has been archived, and as such it is read-only.

Built and signed on GitHub Actions

@cooed/cooed-router is a router library to handle http request.

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
4 months ago (1.0.3)
class Cooed
implements CooedRouter

Examples

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))

Constructors

new
Cooed(_config?: ServerConfig)

Properties

private
_logger: ILogger
private
_route: Route
private
_router: Router

Methods

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

call serve to handle request

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";
or

Import directly with a jsr specifier

import { Cooed } from "jsr:@cooed/cooed-router";

Add Package

pnpm i jsr:@cooed/cooed-router
or (using pnpm 10.8 or older)
pnpm dlx jsr add @cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";

Add Package

yarn add jsr:@cooed/cooed-router
or (using Yarn 4.8 or older)
yarn dlx jsr add @cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";

Add Package

vlt install jsr:@cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";

Add Package

npx jsr add @cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";

Add Package

bunx jsr add @cooed/cooed-router

Import symbol

import { Cooed } from "@cooed/cooed-router";