UNPKG

@t2ee/cookieman

Version:
57 lines (46 loc) 1.2 kB
export { default as Cookie } from './Cookie'; export { default as CookieStore } from './CookieStore'; export { default as MemoryStore } from './MemoryStore'; export { default as InjectCookie } from './InjectCookie'; export { default as JWTStore } from './JWTStore'; export { default as RedisStore } from './RedisStore'; export { bind } from './utils'; /* import Cookie from './Cookie'; import InjectCookie from './InjectCookie'; import JWTStore from './JWTStore'; import { bind } from './utils'; import { Router, GET, Path, Response, HeaderParam } from '@t2ee/vader'; import * as Koa from 'koa'; const store = new JWTStore('secret'); const cookie = new Cookie(); cookie.key = '123'; cookie.expires = new Date(Date.now() + 3600 * 1000); cookie.data = { 'hello': 'world', }; store.set(cookie); @Path('') class TestController { @InjectCookie('TSSESSION') cookie: Cookie; @Path('/user') @GET async getPath() { console.log(this.cookie); return new Response().status(200).build(); } } const app = new Koa(); const router = new Router(); bind(router, store) router.use(TestController); app.use(router.routes()); app.listen(4001); */