@abernier/redirect 中文文档教程
Connect/Express ?redirect
中间件。
简而言之,它允许您使用 ?redirect=/bar
查询字符串参数覆盖任何路由/处理程序 res.redirect('/foo')
。
Example
import express from 'express'
import redirect from '@abernier/redirect'
const app = express()
app.use(redirect())
// ...
app.post('/login', (req, res) => {
// ...
res.redirect('/profile') // *planned redirection
})
*用 redirect
查询字符串参数覆盖它:
$ curl -XPOST http://localhost:3000/login?redirect=/welcomeback
Publish to NPM
准备好将新版本发布到 NPM 注册表了吗?
Manually
- bump the
package.json
version npm login
if not alreadynpm publish
如果成功,您应该要标记版本:
$ git add package.json
$ git commit -m "bump version"
$ git tag v1.0.1
$ git push --tags
Using CI/CD workflow
先决条件:
- Generate a new NPM access token on npmjs.com (you need a NPM account and be logged-in)
- Set it as
NPM_TOKEN
secret (inSettings > Secrets
and as referenced intocicd.yml
file)
然后,要在 npm 上发布新版本:
- bump the
package.json
version - then, create a new realese and wait for the ci/cd publish it
Connect/Express ?redirect
middleware.
In short, it allows you to override any route/handler res.redirect('/foo')
with a ?redirect=/bar
querystring param.
Example
import express from 'express'
import redirect from '@abernier/redirect'
const app = express()
app.use(redirect())
// ...
app.post('/login', (req, res) => {
// ...
res.redirect('/profile') // *planned redirection
})
*Override it with redirect
querystring param:
$ curl -XPOST http://localhost:3000/login?redirect=/welcomeback
Publish to NPM
Ready to publish a new version to NPM registry?
Manually
- bump the
package.json
version npm login
if not alreadynpm 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:
- Generate a new NPM access token on npmjs.com (you need a NPM account and be logged-in)
- Set it as
NPM_TOKEN
secret (inSettings > Secrets
and as referenced intocicd.yml
file)
Then, to release a new version on npm:
- bump the
package.json
version - then, create a new realese and wait for the ci/cd publish it
更多
你可能也喜欢
- 11online-fetch-helpers 中文文档教程
- 19lou-auth-check 中文文档教程
- 5-best-rappers-of-all-time 中文文档教程
- @01js/cli 中文文档教程
- @0xcert/web3-transaction-queue 中文文档教程
- @36node/swagger-cherry-picker 中文文档教程
- @3dwayfinder/touchscroll 中文文档教程
- @8base/permissions-provider 中文文档教程
- @a-a-game-studio/aa-image-manipolatore 中文文档教程
- @aakash-goel/number-formatter 中文文档教程