Skip to main content
Module

x/fastro/examples/readme.md

Fast and simple web application framework for deno
Go to Latest
File

Examples

import { Fastro } from "https://deno.land/x/fastro/mod.ts";

const server = new Fastro();

server.get("/", (req) => req.send("root"));

await server.listen();

You can see above basic example code here: hello.ts

Check the following codes to find out how to:

Create a plugin

You can add new properties or functions to the default request.

import { Fastro, Request } from "https://deno.land/x/fastro/mod.ts";
const server = new Fastro();
const plugin = (req: Request) => {
  req.hello = () => {
    return req.send("Hello");
  };
}
server
  .use(plugin)
  .get("/:hello", (req) => req.hello());
await server.listen();

This feature is similar to the fastify decorator and express middleware.

Check the following codes to find out how to: