0.1.0 • Published 29 days ago

elysia-middleware v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
29 days ago

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)

This plugin is not complete yet, I created this plugin for use with vite dev server so it maybe it only works for development

0.1.0

29 days ago

0.0.0

30 days ago