http3xx

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i http3xx

Weekly Downloads

3

Version

0.0.1

License

none

Last publish

Collaborators

  • tobereplaced