@tanshenghu/node-redis
v1.0.0
Published
node-redis中间件,注意点这个中间件与redis本身没有任何关系,这个中间件需要与@tsh/redis配合才能使用
Downloads
2
Readme
@tanshenghu/node-redis
Installation
npm install @tanshenghu/node-redis --save-dev
or
yarn add @tanshenghu/node-redis --dev
nodejs DEMO
import http from 'http';
import Nredis from '@tanshenghu/node-redis';
const middleware = Nredis();
http.createServer(function(request, response){
middleware({
context: request,
next: Promise.resolve
});
...
...
...
request.setItem('userName', '张三丰');
response.end('');
})
.listen(8080);
koa DEMO
import Koa from 'koa';
import Nredis from '@tanshenghu/node-redis';
const koa = new Koa();
...
...
...
koa.use(Nredis());
...
...
...
koa.listen('8080');