Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

session.js 559 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * @Description: session配置
  3. * @Author: hai-27
  4. * @Date: 2020-04-07 22:28:43
  5. * @LastEditors: hai-27
  6. * @LastEditTime: 2020-04-07 22:29:28
  7. */
  8. let store = {
  9. storage: {},
  10. set (key, session) {
  11. this.storage[key] = session;
  12. },
  13. get (key) {
  14. return this.storage[key];
  15. },
  16. destroy (key) {
  17. delete this.storage[key];
  18. }
  19. }
  20. let CONFIG = {
  21. key: 'koa:session',
  22. maxAge: 86400000,
  23. autoCommit: true,
  24. overwrite: true,
  25. httpOnly: true,
  26. signed: true,
  27. rolling: false,
  28. renew: false,
  29. sameSite: null,
  30. store
  31. }
  32. module.exports = CONFIG;