Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Mar 12, 2024
1 parent b24ba44 commit 00f8635
Show file tree
Hide file tree
Showing 8 changed files with 411 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/check.yaml
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
17 changes: 17 additions & 0 deletions .github/workflows/publish.yaml
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
19 changes: 19 additions & 0 deletions .vscode/settings.json
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"
}
33 changes: 32 additions & 1 deletion README.md
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)
11 changes: 11 additions & 0 deletions deno.jsonc
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"
}
}
13 changes: 13 additions & 0 deletions examples/farm/farm.ts
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));
}
1 change: 1 addition & 0 deletions lib/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./rtx.ts";
Loading

0 comments on commit 00f8635

Please sign in to comment.