node.jsexpressnode.js-connectlocomotivejs

Accessing express.js's connect


I am using Locomotive, and am wondering whether there is a way to access the connect that belongs to the express object somehow. Right now I am loading connect via require, and had to npm install --save connect first to make that happen. How can I use the connect that belongs to Express/Locomotive. Is that a bad idea? Should I just maintain my own dependency?


Solution

  • Every time you use something like:

    .use(express.cookieParser())
    

    you are using the underlying connect methods, which have been extended by express. So, you don't need to install a separate copy of connect.