Skip to main content

Usage example

import { Application } from "https://deno.land/x/oak@v9.0.1/mod.ts";
import { statics } from "./mod.ts";

const app = new Application();

const router = await statics("path/to/statics");

await router.statics("path/to/statics/views");
await router.statics("path/to/statics/styles");
await router.statics("path/to/statics/scripts");

app.use(router.routes());
await app.listen({ port: 8080 });

statics function receive two arguments

  • path Defines the static directory path
  • router It defines the router to use, if it is not defined it will create a new one.

statics function returns a method to define more static routes and the router

Dependencies