nuxt-express-compat
v0.0.5
Published
Use an Express app in a Nuxt app as a middleware.
Downloads
1
Readme
nuxt-express-compat
Use an Express app in a Nuxt app as a middleware.
Installation
pnpm add nuxt-express-compat
Usage
Add your express app inside server/middleware/express.ts
import express from 'express'
import { fromExpressApp } from 'nuxt-express-compat'
const app = express()
app.get('/api/ping', (req, res) => {
res.send('pong')
})
app.post('/api/user', (req, res) => {
const body = req.body
res.json({ username: body.username })
})
export default fromExpressApp(app)
License
MIT