Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.