-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c18a0da
Showing
7 changed files
with
474 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Check | ||
"on": | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
- name: Format | ||
run: deno fmt && git diff-index --quiet HEAD | ||
- name: Lint | ||
run: deno lint && git diff-index --quiet HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Publish | ||
"on": | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
- name: Publish package | ||
run: deno publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"deno.enable": true, | ||
"deno.unstable": true, | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"[markdown]": { | ||
"editor.defaultFormatter": "denoland.vscode-deno" | ||
}, | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "denoland.vscode-deno" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "denoland.vscode-deno" | ||
}, | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "denoland.vscode-deno" | ||
}, | ||
"files.eol": "\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# rt | ||
|
||
[![JSR][JSR badge]][JSR] [![JSR score][JSR score badge]][JSR score] | ||
[![GitHub | ||
Actions][GitHub Actions badge]][GitHub Actions] | ||
|
||
Minimal HTTP router library based on the `URLPattern` API. | ||
|
||
## Usage | ||
|
||
```ts | ||
import { createRouter } from "@fartlabs/rt"; | ||
|
||
const router = createRouter() | ||
.get("/", () => { | ||
return new Response("Hello, World!"); | ||
}) | ||
.default(() => new Response("Not found", { status: 404 })); | ||
|
||
Deno.serve((request) => router.fetch(request)); | ||
``` | ||
|
||
### Deno | ||
|
||
1\. [Install Deno](https://docs.deno.com/runtime/manual). | ||
|
||
2\. Start a new Deno project. | ||
|
||
```sh | ||
deno init | ||
``` | ||
|
||
3\. Add rt as a project dependency. | ||
|
||
```sh | ||
deno add @fartlabs/rt | ||
``` | ||
|
||
## Contribute | ||
|
||
We appreciate your help! | ||
|
||
### Style | ||
|
||
Run `deno fmt` to format the code. | ||
|
||
Run `deno lint` to lint the code. | ||
|
||
--- | ||
|
||
Developed with ❤️ [**@FartLabs**](https://github.com/FartLabs) | ||
|
||
[JSR]: https://jsr.io/@fartlabs/rt | ||
[JSR badge]: https://jsr.io/badges/@fartlabs/rt | ||
[JSR score]: https://jsr.io/@fartlabs/rt/score | ||
[JSR score badge]: https://jsr.io/badges/@fartlabs/rt/score | ||
[GitHub Actions]: https://github.com/FartLabs/rt/actions/workflows/check.yaml | ||
[GitHub Actions badge]: https://github.com/FartLabs/rt/actions/workflows/check.yaml/badge.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"lock": false, | ||
"name": "@fartlabs/rt", | ||
"version": "0.0.1", | ||
"exports": { | ||
".": "./mod.ts" | ||
}, | ||
"tasks": { | ||
"example": "deno run --allow-net examples/farm/farm.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @module | ||
* | ||
* rt is a minimalistic HTTP router library based on the `URLPattern` API. | ||
*/ | ||
|
||
export * from "./rt.ts"; |
Oops, something went wrong.