use-express
v0.3.2
Published
Mock express in use-*
Downloads
2
Maintainers
Readme
Mock express in use-*
Simulate part of express api in use-*
Features
- Currently support
express.Router
andexpress.use|all|get|post|...()
for express middlewares
Usage
const useServer = require('use-server');
const useExpress = require('use-express')
const app = useExpress(useServer())
//use-* like middleware
app.use(async (req, resp, next)=>{
await next()
})
//express middlewares
app.express.get('/a', (req, resp, next)=>{
console.log(req.url);
next()
})
app.express.use(require('compression')())
app.express.use(require('body-parser').json())
License
Licensed under MIT
Copyright (c) 2016 kiliwalk