0.1.0 • Published 29 days ago
elysia-middleware v0.1.0
elysia-middleware
Plugin for elysia use node middleware
Installation
bun add elysia-middleware
Example
import { Elysia } from 'elysia'
import { middleware_plugin } from 'elysia-middleware'
const app = new Elysia()
.use(middleware_plugin())
.get('/', async ({ connect, ...ctx}) => {
connect.use(middleware);
const res = await connect.handle();
// means that the middleware has handled the request and return the response
if (res) return res
// no response from middleware, continue to the next handler
return ctx
})
.listen(3000)