|
@@ -0,0 +1,15 @@
|
|
|
+import { Middleware } from 'org.crazydoctor.expressts';
|
|
|
+import {NextFunction, Request, Response} from 'express';
|
|
|
+import { ISession } from '../session/ISession';
|
|
|
+
|
|
|
+class SessionRenewMiddleware extends Middleware {
|
|
|
+ protected action = (req: Request, res: Response, next: NextFunction): any => {
|
|
|
+ const session: ISession = req.session as ISession;
|
|
|
+ session.lastAccess = new Date().getTime();
|
|
|
+ next();
|
|
|
+ };
|
|
|
+ protected order = 1;
|
|
|
+ protected route = null;
|
|
|
+}
|
|
|
+
|
|
|
+export default SessionRenewMiddleware;
|