Skip to main content
Module

x/fastro/benchmarks/_template.md

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

Web framework for developers obsessed with performance and simplicity

ci

Fastro is inspired by Fastify & Express.

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

Benchmarks

If performance is important to you, here are the benchmark results:

Framework Version Router? Avg Req
Abc ${abc_version} ${abc}
Deno http ${deno_version} ${deno_http}
Express ${express_version} ${express}
Fastify ${fastify_version} ${fastify}
Fastro ${fastro_version} ${fastro}
Node http ${node_version} ${node}
Oak ${oak_version} ${oak}

Check this folder to see the detail method.

Middleware

You can add new properties or functions to the default request. This is similar to the express middleware.

const middleware = (req: Request) => {
  req.hi = (word: string) => {
    req.send(word);
  };
};

server.use(middleware);

Plugin

You can add new properties or functions to the fastro instance. You can also use all default instance functions, include create routes & middleware. This is similar to the fastify plugin.

const routes = function (fastro: Fastro) {
  fastro
    .get("/", (req) => {
      req.send("root");
    })
    .post("/", (req) => {
      req.send("post");
    })
    .put("/", (req) => {
      req.send("put");
    })
    .delete("/", (req) => {
      req.send("delete");
    });
};

server.register(routes);

How to use

This module uses the git release. If you want to pick a specific version, for example v0.6.0, then the full url is https://deno.land/x/fastro@v0.6.0/mod.ts. If you do not use the version, it will refer to master branch.

Examples

Check this folder to find out how to: