class OakRouter
implements IRouter
import { OakRouter } from "https://deno.land/x/deno_nest@v3.4.0/modules/oak/src/router.ts";
Properties
private
app: OakApplicationprivate
router: OakOriginRouterMethods
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)
useOriginMiddleware(fn: OakMiddleware, path?: string)