Skip to main content
Module

x/abc/app.ts>Application

A better Deno framework to create web application.
Latest
class Application
import { Application } from "https://deno.land/x/abc@v1.3.3/app.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 });

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.