Using Connect

Date Published:
Last Modified:


Connect is a middleware framework for node. It contains a body parser, cookie manager, session management, static file server, query string parser, favicon server, and more.

The Express extension uses the Connect extension to provide some of it’s functionality.


To install Connect, you can use NPM (node package manager) with the following command:

$ npm install connect

Static File Server

One of Connects useful features is the ability to easily create a static file server. The most basic file server can be achieved with the following code:

    .use(connect.static(__dirname + '/public'))

__dirname is a special variable which represents the current directory the code file is in.


    comments powered by Disqus