If I wanted to utilise useful middleware like express.cookieParser(); and suchlike, am I expected to be economical with my instances of express when splitting my NodeJS application up into different files.
For example, if I use var express = require('express') in one file, and again in many others, am I wasting resources fetching these and re-instantiating them? Or does require cache modules, or (even better) create a global instance of them?
I know the performance impact of requiring express on multiple files would probably be negligible - this is more of a question to help me understand how modules load.
When you require a module twice, the second require uses the cached exports object that was called earlier.
Source: http://docs.nodejitsu.com/articles/getting-started/what-is-require