webhandle-redirector

1.0.0 • Public • Published

Creates Express middleware to handle redirection

Redirect Definition

[
	{
		"from": "/old-url",
		"to": "/new-url",
		"status": 302
	}
]

Status is optional (302 is default). Case must match.

Use

router.use(require('webhandle-redirector')(JSON.parse(fs.readFileSync(configFilePath))))

or, if you're using a webhandle to set up your express environment,

require('webhandle-redirector/webhandle-setup')()

The webhandle setup assumes a file in the project directory config/redirects.json.

Readme

Keywords

Package Sidebar

Install

npm i webhandle-redirector

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

1.67 kB

Total Files

4

Last publish

Collaborators

  • dankolz