Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/l2ig/aqua
A minimal and fast 🏃 web framework for Deno
https://github.com/l2ig/aqua
aqua cookies deno file-upload hacktoberfest http http-server middlewares typescript web web-framework
Last synced: 3 months ago
JSON representation
A minimal and fast 🏃 web framework for Deno
- Host: GitHub
- URL: https://github.com/l2ig/aqua
- Owner: predetermined
- License: lgpl-3.0
- Created: 2020-05-10T16:56:01.000Z (over 4 years ago)
- Default Branch: v2
- Last Pushed: 2023-12-13T11:23:26.000Z (11 months ago)
- Last Synced: 2024-07-23T17:03:48.982Z (4 months ago)
- Topics: aqua, cookies, deno, file-upload, hacktoberfest, http, http-server, middlewares, typescript, web, web-framework
- Language: TypeScript
- Homepage:
- Size: 199 KB
- Stars: 217
- Watchers: 5
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - aqua - A minimal and fast web framework for Deno. (Modules / Web framework)
- awesome-deno-cn - @l2ig/aqua
- awesome-deno - aqua - A minimal and fast web framework for Deno. ![GitHub stars](https://img.shields.io/github/stars/l2ig/aqua?style=plastic&logoWidth=1) (Modules / Online Playgrounds)
README
# Aqua
Aqua is a minimal and fast web framework.
> :warning: This version is a WIP and has not yet been released. Please refer to the [main branch](https://github.com/grayliquid/aqua/tree/main) for the current documentation.
## Example usage
### It starts easy,
```typescript
import { Aqua } from "...";const app = new Aqua({
listen: {
port: 80,
},
});app.route("/").respond(Method.GET, (_event) => {
return new Response("Hello, World!");
});
```### ... and stays easy.
```typescript
const v1 = app.route("/v1").step(async (event) => {
if (!event.request.headers.has("X-Api-Key")) {
event.response = Response.json(
{ error: "MISSING_API_KEY" },
{
status: 400,
}
);
return event.end();
}const user = await getUserByRequest(event.request);
// ^ type Userreturn {
...event,
user,
};
});v1.route("/user").respond(Method.GET, (event) => {
return Response.json({ data: { user: event.user } });
// ^ type User
});
```