High performance backend module. Built on top of Deno standard library. No external dependencies. Written in TypeScript.
multipart/form-data
application/json
application/x-www-form-urlencoded
You can see the details in the examples.
Create webapp
folder
mkdir webapp && cd webapp
Create main.ts
import { Fastro } from "https://raw.githubusercontent.com/fastrodev/fastro/master/mod.ts";
new Fastro().listen();
Run server
deno run -A main.ts
Open url
http://localhost:3000
The structure will be like this:
webapp
├── main.ts
└── services
└── hello.controller.ts
File and folder description:
main.ts
: Webapp entrypoint.services
: Default folder for all handler files. You can change it via ServerOptions.services/hello.controller.ts
: Endpoint handler. You can access it via URL: http://localhost:3000/hello.Create entrypoint main.ts
import { Fastro } from "https://raw.githubusercontent.com/fastrodev/fastro/master/mod.ts";
const server = new Fastro();
server.listen();
Create handler hello.controller.ts
import type { Request } from "https://raw.githubusercontent.com/fastrodev/fastro/master/mod.ts";
export const handler = (request: Request) => {
request.send("hello");
};
Please note that the handler file name will be used as URL endpoint:
Run server
deno run -A main.ts
Open url
http://localhost:3000/hello
You can also run your project using fastro command line interface (fastro-cli).
With this, you don’t need an entrypoint file (main.ts
) anymore.
Install fastro-cli
deno install -A https://raw.githubusercontent.com/fastrodev/fastro/master/cli/fastro.ts
Run in development (HMR)
Modules will be reloaded when changes are made.
fastro serve
Run in production
You can change the app port also.
fastro serve --port 8080 --production
Performance test with hello world keep-alive connection.
Module | Version | Req/s | Percentage |
---|---|---|---|
Deno | 0.73.0 | 16384.0 | 100.00% |
Fastro | 0.30.5 | 15291.2 | 93.33% |
You can see the details in the benchmarks.
Author: fastrodev
Demo: https://fastro.dev/fastro/
Source Code: https://github.com/fastrodev/fastro
#deno #node #nodejs #javascript