SessionMiddleware.ts 539 B

12345678910
  1. import { Middleware } from '../base/http';
  2. import session from 'express-session';
  3. import { Guid } from '../base/util';
  4. class SessionMiddleware extends Middleware {
  5. protected order = -98;
  6. protected route = null;
  7. protected action = session({ secret: this.context.options?.sessionSecret || Guid.new(), resave: this.context.options?.sessionResave || false, saveUninitialized: this.context.options?.sessionSaveUninitialized || false, cookie: { maxAge: this.context.options?.sessionMaxAge || 3600000 } });
  8. }
  9. export default SessionMiddleware;