0.3.0 • Published 12 months ago
@wooksjs/fastify-adapter v0.3.0
Fastify Adapter (Wooks Composables)
!!! This is work-in-progress library, breaking changes are expected !!!
Want to use @wooksjs/event-http but your project is coupled with fastify? ✅ This is not a problem with this Fastify Adapter for wooks
Install
npm install @wooksjs/fastify-adapter @wooksjs/event-http
Usage
import fastify from 'fastify'
import { applyFastifyAdapter } from '@wooksjs/fastify-adapter'
import { useBody } from '@wooksjs/http-body'
import { WooksError } from '@wooksjs/event-http'
import { useRouteParams } = from '@wooksjs/event-core'
const app = fastify()
applyFastifyAdapter(app)
app.get('/test/:param', () => {
const { get } = useRouteParams()
return { message: 'it works', param: get('param') }
})
app.post('/post', () => {
const { parseBody } = useBody()
return parseBody()
})
app.get('/error', () => {
throw new WooksError(400, 'test error')
})
app.listen(3000, () => console.log('listening 3000'))
0.3.0
12 months ago
0.2.1
12 months ago
0.2.0
12 months ago
0.1.0
1 year ago
0.0.1-alpha.1
1 year ago
0.0.1-alpha.0
2 years ago