Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svenliebig/express-parameter-rewriter
✍️Middleware that allows you to reconfigure the request parameter.
https://github.com/svenliebig/express-parameter-rewriter
express-middleware url-parameters
Last synced: about 14 hours ago
JSON representation
✍️Middleware that allows you to reconfigure the request parameter.
- Host: GitHub
- URL: https://github.com/svenliebig/express-parameter-rewriter
- Owner: svenliebig
- License: mit
- Created: 2019-08-03T15:33:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-11T00:35:54.000Z (almost 4 years ago)
- Last Synced: 2025-02-11T23:47:18.649Z (8 days ago)
- Topics: express-middleware, url-parameters
- Language: TypeScript
- Homepage: https://sly321.github.io/express-parameter-rewriter/
- Size: 747 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# express-parameter-rewriter
Middleware that allows you to reconfigure the request parameter.
[](https://travis-ci.org/Sly321/express-parameter-rewriter)
[](https://coveralls.io/github/Sly321/express-parameter-rewriter?branch=master)
[](https://stryker-mutator.github.io)
[](https://github.com/semantic-release/semantic-release)## Usage
With yarn:
```bash
yarn add express-parameter-rewriter
```or npm:
```bash
npm i express-parameter-rewriter --save
```### Example
```typescript
import * as express from 'express'// import
import parameterRewriter from 'express-parameter-rewriter'const app = express()
app.use(parameterRewriter({ hello: 'bye' })) // usageapp.use((req, res, next) => {
console.log(req.url)
console.log(req.originalUrl)
console.log(req.query)
next()
})app.listen(3000, '0.0.0.0', () => {
console.log('Listening on localhost:3000')
})
```If you call `http://localhost:3000/?hello=world` (Tools like Insomnia, [VSCode Extension Rest Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) or any other restclient will do the job), the app will log:
```bash
/?bye=world
/?bye=world
{ bye: "world" }
```