https://github.com/erfanium/denzo
Well designed web framework for Deno. similar to Fastify
https://github.com/erfanium/denzo
api deno http javascript rest typescript
Last synced: 18 days ago
JSON representation
Well designed web framework for Deno. similar to Fastify
- Host: GitHub
- URL: https://github.com/erfanium/denzo
- Owner: erfanium
- License: mit
- Created: 2021-08-10T09:38:18.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-12T09:54:59.000Z (over 4 years ago)
- Last Synced: 2025-02-13T09:17:50.400Z (12 months ago)
- Topics: api, deno, http, javascript, rest, typescript
- Language: TypeScript
- Homepage:
- Size: 85.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Denzo
Well designed web framework for Deno. similar to
[Fastify](https://github.com/fastify/fastify). Uses Deno native http server.
(which is unstable right now)
## Hello world
app.ts
```ts
import {
Denzo,
listenAndServe,
printRoutes,
} from "https://deno.land/x/denzo/mod.ts";
const app = new Denzo();
interface RouteTypes {
Response: {
hello: string;
};
}
app.route({
method: "GET",
url: "/hi",
handler() {
return { hello: "world!" };
},
});
listenAndServe(3000, app);
printRoutes(app);
console.log("listening on port 3000");
```
```sh
deno run --allow-net --unstable app.ts
```
See [examples](https://github.com/erfanium/denzo/tree/main/examples)
## Goals
**Well and Reliable design**: Denzo follows Fastify design which benefit large
projects.\
**Fast**: Denzo uses brand new Deno native http server which is faster and
better for http/2 protocol.\
**First-Class validation**: Like Fastify, Denzo support JSON schemes (also
fluent-json-schema).\
**Safe**: Plugins are limited to their scope, unless you grant access.
## Differences with Fastify
Denzo is inspired by Fastify, but it doesn't mean it's a Fastify port for Deno.
There's some differences that we prefer:
### No callback support
Callbacks are fast, but supporting callbacks and promises together is
troublesome. so you should always use `async` function or return a `Promise` for
your async code.
### `Keys` instead of `decorators`
Fastify decorators design is not Typescript friendly, You can use our `Keys`
design to safely pass data between hooks. see examples/keys.ts.
## Plugins
### Official
- [denzo-cors](https://github.com/irandeno/denzo-cors)
- [denzo-logger](https://github.com/irandeno/denzo-logger)
## Discord chat
We would love to hear your feedback and questions! https://discord.gg/YP5TgWbd2C