-
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
1 parent
b24ba44
commit 00f8635
Showing
8 changed files
with
411 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# rtx | ||
Simple HTTP library engineered for developer maintainability and convenience. | ||
|
||
Minimal HTTP router library based on the `URLPattern` API. | ||
|
||
## Usage | ||
|
||
### Deno | ||
|
||
1\. [Install Deno](https://docs.deno.com/runtime/manual). | ||
|
||
2\. Start a new Deno project. | ||
|
||
```sh | ||
deno init | ||
``` | ||
|
||
3\. Add rtx as a project dependency. | ||
|
||
```sh | ||
deno add @fartlabs/rtx | ||
``` | ||
|
||
## Contribute | ||
|
||
### Style | ||
|
||
Run `deno fmt` to format the code. | ||
|
||
Run `deno lint` to lint the code. | ||
|
||
--- | ||
|
||
Developed with ❤️ [**@FartLabs**](https://github.com/FartLabs) |
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/rtx", | ||
"version": "0.0.0", | ||
"imports": { | ||
"rtx/": "./lib/" | ||
}, | ||
"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,13 @@ | ||
import { createRouter } from "rtx/mod.ts"; | ||
|
||
if (import.meta.main) { | ||
const router = createRouter() | ||
.with<"id">( | ||
{ method: "GET", pattern: new URLPattern({ pathname: "/farms/:id" }) }, | ||
({ params }) => { | ||
return new Response(`Farm ID: ${params.id}`); | ||
}, | ||
); | ||
|
||
Deno.serve(router.fetch.bind(router)); | ||
} |
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 @@ | ||
export * from "./rtx.ts"; |
Oops, something went wrong.