1.0.7 • Published 2 years ago

@abernier/redirect v1.0.7

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

ci/cd NPM version Coverage Status

Connect/Express ?redirect middleware.

In short, it allows you to override any route/handler res.redirect('/foo') with a ?redirect=/bar querystring param.

Examples

Setup:

import express from 'express'
import redirect from '@abernier/redirect'

const app = express()
app.use(redirect())

Basic

app.post('/login', (req, res) => {
  // ...

  res.redirect('/profile') // default redirection
})

Override the default redirection -> be redirected to /welcomeback by adding a ?redirect querystring param:

$ curl -XPOST http://localhost:3000/login?redirect=/welcomeback

Publish to NPM

Ready to publish a new version to NPM registry?

Manually

  1. bump the package.json version
  2. npm login if not already
  3. npm publish

If successful, you should want to tag the version:

$ git add package.json
$ git commit -m "bump version"
$ git tag v1.0.1
$ git push --tags

Using CI/CD workflow

Pre-requisite: 1. Generate a new NPM access token on npmjs.com (you need a NPM account and be logged-in) 2. Set it as NPM_TOKEN secret (in Settings > Secrets and as referenced into cicd.yml file)


Then, to release a new version on npm: 1. bump the package.json version 2. then, create a new realese and wait for the ci/cd publish it

Links

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago