How does node express-session set session, to expire when the browser is closed, or when the session lasts for more than 30 minutes?

tomcat can set session expiration policy: browser closes or times out.
but after express-session sets cookie.maxAge, browser shutdown will not cause session expiration.
so how to implement this policy in node environment


try to select "session cookie" (specific google), and then delete the timed-out cookie when node processes the request.

const TIMEOUT = 1000 * 60 * 30; // 30 

let middleware = function (req, res) {
    let now = Date.now(); // 
    // 
    let isTimeout = req.session.ts && now - req.session.ts > TIMEOUT; 
    if (isTimeout) {
        req.session.destroy(); //  session
    } else {
        req.session.ts = Date.now(); // 
    }
}

//  express-session 
app.use(middleware);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46a8f-2710d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46a8f-2710d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?