Express.js is the session and cookie used by the static file middleware?

With the following express.js application:

app.use( cookieParser );
app.use( session( /*options*/) );
app.use( serveStatic( './dir' ) );

app.get( '/foo', onlyLogicThatNeedsSession )

I presume that the session data is being acquired even when static files are being served.

1: is this correct?

If so, that would imply that the app would be better structure as:

app.use( serveStatic( './dir' ) );

app.get( 'foo', cookieParser, session, onlyLogicThatNeedsSession )

2: would the give a performance advantage? I.e. if the session store was redis, the redis server would not be getting hit when serving static files?

Yes, the middleware are executed in order, so ideally you would put the static middleware at the very top so that you can bypass any unnecessary additional request processing.