yeps-express-wrapper
v1.0.1
Published
YEPS express wrapper
Downloads
8
Maintainers
Readme
YEPS express wrapper
It helps run express middleware on YEPS
How to install
npm i -S yeps-express-wrapper
How to use
const path = require('path');
const App = require('yeps');
const error = require('yeps-error');
const Router = require('yeps-router');
const server = require('yeps-server');
const wrapper = require('yeps-express-wrapper');
const app = new App();
const router = new Router();
// express middleware
const favicon = require('serve-favicon');
app.then(wrapper(favicon(path.join(__dirname, 'public', 'favicon.ico'))));
app.then(error());
router.get('/').then(async ctx => {
ctx.res.statusCode = 200;
ctx.res.end('test');
});
app.then(router.resolve());
server.createHttpServer(app);