micro-redirect

1.0.2 • Public • Published

Micro Redirect -

A redirect function for Zeit's micro

Build Status Maintainability Test Coverage

Usage

Firstly, install it:

npm install --save micro-redirect

Then import it like this:

const redirect = require("micro-redirect");

And use it the same you'd use Zeit's send:

module.exports = async (req, res) => {
  const statusCode = 302;
  const location = "http://github.com";
 
  redirect(res, statusCode, location);
};

API

redirect(res, statusCode, location)

  • statusCode is a Number with the HTTP redirect code, and must always be supplied.
  • location is a String used to set the res header location, and must always be supplied.

Readme

Keywords

Package Sidebar

Install

npm i micro-redirect

Weekly Downloads

672

Version

1.0.2

License

MIT

Unpacked Size

3.24 kB

Total Files

4

Last publish

Collaborators

  • timreynolds