Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno_nest/modules/oak/src/router.ts>OakRouter

Refer to nestjs to realize some common functions for Deno, support hono and oak
Go to Latest
class OakRouter
implements IRouter
import { OakRouter } from "https://deno.land/x/deno_nest@v3.5.1/modules/oak/src/router.ts";

Constructors

new
OakRouter(options?: { strict?: boolean; })

Properties

private
app: OakApplication
private
router: OakOriginRouter

Methods

private
serveStaticAssets(context: OakContext, options: StaticOptions)
delete(path: string, fn: MiddlewareHandler)
get(path: string, fn: MiddlewareHandler)
patch(path: string, fn: MiddlewareHandler)
post(path: string, fn: MiddlewareHandler)
put(path: string, fn: MiddlewareHandler)
routes(): void

start serve view and static assets.

If has prefix either api or view of static assets, it will be served self without other check, so it`s a good idea to set prefix if you want to have a good performance.

Then it will check the extension of the pathname, if its optioned such as ejs`, it will be served view, otherwise it will be served static assets.

But if there is index.html in the static assets, it will be served first before the view.