@response/redirect
v0.1.2
Published
A class representing a redirect response.
Downloads
3
Readme
Redirect Response
A class representing a redirect response.
Installation
npm install @response/redirect
Usage
const redirect = require('@response/redirect')
const http = require('http')
http.createServer((req, res) => {
// Status 302
redirect('/thing').write(res)
// Status 301
redirect(301, '/thing').write(res)
// Status 301 & custom headers
redirect(301, '/thing', { 'X-Powered-By': 'Foobar' }).write(res)
})
Mutable Properties
statusCode: number
- The status codeheaders: object
- The custom headersurl: string
- The target of the redirect