Module

x/abc/mod.ts>Application

A better Deno framework to create web application.
Go to Latest
class Application
import { Application } from "https://dotland.deno.dev/x/abc@v1.2.4/mod.ts";

Hello World.

const app = new Application();

app .get("/hello", (c) => { return "Hello, Abc!"; }) .start({ port: 8080 });

Properties

middleware: MiddlewareFunc[]
premiddleware: MiddlewareFunc[]
renderer: Renderer | undefined
router: Router
server: Server | undefined
readonly
θprocess: Promise<void> | undefined

Unstable

Methods

add(
method: string,
path: string,
handler: HandlerFunc,
...middleware: MiddlewareFunc[],
): Application
any(
path: string,
): Application
close(): Promise<void>

Stop the server immediately.

await app.close();

connect(
path: string,
): Application
delete(
path: string,
): Application
file(
path: string,
filepath: string,
): Application

Register a new route with path to serve a static file with optional route-level middleware.

app.file("/", "public/index.html");

get(
path: string,
): Application
group(prefix: string, ...m: MiddlewareFunc[]): Group

group creates a new router group with prefix and optional group level middleware.

head(
path: string,
): Application
match(
methods: string[],
path: string,
): Application
options(
path: string,
): Application
patch(
path: string,
): Application
post(
path: string,
): Application

pre adds middleware which is run before router.

put(
path: string,
): Application
start(sc: HTTPOptions): void

Start an HTTP server.

app.start({ port: 8080 });

startTLS(sc: HTTPSOptions): void

Start an HTTPS server.

static(
prefix: string,
root: string,
): Application

Register a new route with path prefix to serve static files from the provided root directory. For example, a request to /static/js/main.js will fetch and serve assets/js/main.js file.

app.static("/static", "assets");

trace(
path: string,
): Application

use adds middleware which is run after router.

import Application
import { Application } from "https://dotland.deno.dev/x/abc@v1.2.4/mod.ts";