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

x/deno_nest/modules/oak/mod.ts>OakRouter

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

Constructors

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

Properties

private
app: OakApplication
private
router: OakOriginRouter

Methods

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

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.

startServer(options: ListenOptions)
use(fn: MiddlewareHandler)