0.0.4 • Published 6 years ago
response-handler-feng v0.0.4
Introduction
url match middleware of koa
Usage
npm install --save response-handler-feng
const app=require('koa')();
const match=require('url-match-feng');
const cache=require('url-cache-feng');
const validate=require('params-validate-feng');
const hanlder=require('response-hanlder-feng');
const Redis=require('ioredis');
const path=require('path');
const redis=new Redis();
const routesconfig={
'/index': { method: 'GET', cache: 300, main: 'index', type: 'html' },
'/channel': { method: 'GET', cache: 200, main: 'channel', type: 'html' },
};
app.use(match({routesConfig}));
app.use(cache({engine:redis,prefix:'app'}));
app.use(validate());
app.use(handler({path:path.resolve('./api')}));
app.listen(3000);
options
options.path
path of api