1.0.0 • Published 6 years ago

webhandle-redirector v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

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.