node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…


Connect Middleware to force visitors onto a single domain

Connect Force Domain

Inspired by Rack::ForceDomain it directs all traffic to a single domain with a 301 redirect.

This is useful where you are hosting your node site with a PaaS provide like Joyent or Nodester and want to ensure all visitors are on the same domain.

via npm

npm install connect-force-domain

For connect

var connect = require('connect'),
    http = require('http'),
    forceDomain = require('connect-force-domain');

var app = connect()

For express

var express = require('express'),
    forceDomain = require('connect-force-domain');

var app = module.exports = express.createServer();