https://github.com/jabernardo/rute
A Simple Router for Deno
https://github.com/jabernardo/rute
deno denoland http javascript middleware router server typescript web
Last synced: about 1 month ago
JSON representation
A Simple Router for Deno
- Host: GitHub
- URL: https://github.com/jabernardo/rute
- Owner: jabernardo
- License: mit
- Created: 2020-04-06T03:59:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-02T10:16:04.000Z (about 5 years ago)
- Last Synced: 2025-10-04T01:49:10.210Z (6 months ago)
- Topics: deno, denoland, http, javascript, middleware, router, server, typescript, web
- Language: TypeScript
- Homepage: https://deno.land/x/rute/
- Size: 3.91 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rute
A Simple Router for Deno
([https://deno.land/x/rute](https://deno.land/x/rute))

[](https://github.com/denoland/deno)
## Prerequisites
- deno 1.0.2
## Releases
- `0.11` - Rute for Deno v1.0.0
- `0.12` - Optional middlewares
- `0.13` - CORS middleware, deps.ts, static glob
## Branches
- `master` - Recent Release
- `0.x` - Development branch for version 0.x
## Installation
```ts
import {
Server,
Request,
Response,
Middleware,
Next
} from "https://deno.land/x/rute/mod.ts";
```
## Run this example
```sh
deno run --allow-net --allow-read "https://deno.land/x/rute/example/basic/app.ts"
```
## Hello World!
```ts
import {
Server,
Request,
Response
} from "https://deno.land/x/rute/mod.ts";
const app: Server = new Server();
app.get("/", (req: Request, res: Response) => {
res.set({"message": "Hello World!"});
});
app.listen({ port: 8000 });
```
## Built-in await/async support!
```ts
/**
* Index page
*/
app.all("/", async (req: Request, res: Response) => {
let data = await fetch("https://hacker-news.firebaseio.com/v0/item/2921983.json?print=pretty");
let json = await data.json();
console.log(json);
res.set(json);
});
```
## Want to combine your apps?
```ts
import { app as secondApp } from "../second_app/app.ts";
/**
* Root application
*
* path: /
*/
const app: Server = new Server("multi_app");
/**
* Second application
*
* path: /second
*/
app.use(secondApp.rebase("second"));
```
## Learn more!
### Examples
We have few examples provided, that could be found [here](https://github.com/jabernardo/rute/tree/master/example).
### Wiki
Our wiki is located [here](https://github.com/jabernardo/rute/wiki)
## Contibuting to Rute!
To contribute to Rute! Make sure to give a star and forked this repository. Current development branch is `0.x`, so make sure to checkout it.
Alternatively see the GitHub documentation on [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
## License
The `Rute` is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).