README.md
January 3, 2020 ยท View on GitHub
Micro Redirect -
A redirect function for Zeit's micro
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)
statusCodeis aNumberwith the HTTP redirect code, and must always be supplied.locationis aStringused to set the res header location, and must always be supplied.