0.1.2 • Published 7 months ago

@response/redirect v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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 code
  • headers: object - The custom headers
  • url: string - The target of the redirect
0.1.2

7 months ago

0.1.1

4 years ago

0.1.0

4 years ago