Node.JS Connect module for no-www redirection
Redirects any domain with
www to the same site without it.
All domains should have a
www for backwards compatibility with what
early adopters of the internet have come to expect (and ctrl+enter adds it).
However, those domains should redirect to the root of the domain.
- it means we type four fewer charaters
- we don't type
http://anymore, why would we type
- it's what the cool kids do (i.e. github)
ssh, etc all have their own protocols. Why should the web also have a prefix?
npm install nowww
'use strict';var http = require'http' // (or https / spdy)connect = require'connect' // or expressnowww = require'./'app = connectserver;appusenowwwuserequire'serve-static'__dirname + '/public/';server = httpcreateServer;serveron'request' app;serverlisten3000console.log'Listening on ' + serveraddressport;;;