Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bunsvr/router
A blazing-fast router for Stric
https://github.com/bunsvr/router
bun router stric
Last synced: 4 months ago
JSON representation
A blazing-fast router for Stric
- Host: GitHub
- URL: https://github.com/bunsvr/router
- Owner: bunsvr
- Archived: true
- Created: 2022-12-31T03:24:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-29T14:27:06.000Z (about 1 year ago)
- Last Synced: 2024-09-19T06:18:06.390Z (4 months ago)
- Topics: bun, router, stric
- Language: TypeScript
- Homepage: https://stricjs.netlify.app/#/basic/routing/main
- Size: 237 KB
- Stars: 50
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
An minimal, heavily-optimized router for Stric.
```typescript
import { Router, macro } from '@stricjs/router';// Create a router and serve using Bun
export default new Router()
// Handle GET request to `/`
.get('/', macro('Hi'))
// Handle POST request to `/json`
.post('/json', ctx => ctx.data, { body: 'json', wrap: 'json' })
// Return 90 for requests to `/id/90` for instance
.get('/id/:id', ctx => ctx.params.id, { wrap: true })
// Use the default 404 handler
.use(404);
```See the [docs](https://stricjs.netlify.app) for more details.