http3xx

Send HTTP 3xx redirections in node.js.

npm install http3xx
4 downloads in the last month

http3xx

Send HTTP 3xx redirections is node.js.

Written in CoffeeScript.

Installation

npm install http3xx

Usage

From the source:

These functions all accept a res argument, which is an http.ServerResponse object. For those functions that accept a url argument, url is meant to be an absolute URI. Do not pass through a relative URI. Although it would likely work, that would be in violation of RFC 2616.

Example handlers

function(req, res) {
  return http3xx.movedPermanently(res, 'http://localhost:8080/301');
};

function(req, res) {
  return http3xx.found(res, 'http://localhost:8080/302');
};

function(req, res) {
  return http3xx.seeOther(res, 'http://localhost:8080/303');
};

function(req, res) {
  return http3xx.notModified(res); // 304
};

function(req, res) {
  return http3xx.useProxy(res, 'my-proxy-server:305');
};

function(req, res) {
  return http3xx.temporaryRedirect(res, 'http://localhost:8080/307');
};

License

MIT style

npm loves you