Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/john-doherty/express-seo-noslash
Remove trailing slashes from incoming urls
https://github.com/john-doherty/express-seo-noslash
express seo
Last synced: about 1 month ago
JSON representation
Remove trailing slashes from incoming urls
- Host: GitHub
- URL: https://github.com/john-doherty/express-seo-noslash
- Owner: john-doherty
- License: mit
- Created: 2020-07-26T18:33:55.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-27T10:10:37.000Z (almost 3 years ago)
- Last Synced: 2024-11-13T00:32:31.069Z (about 1 month ago)
- Topics: express, seo
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# express-seo-noslash
Express middleware to remove trailing slashes from incoming urls using 301 redirects.
## Install
```bash
npm install --save express-seo-noslash
```## Usage
Add middleware to your express application before all other routes.
```js
var express = require('express');
var app = express();
var removeTrailingSlash = require('express-seo-noslash');// add middleware
app.use(removeTrailingSlash);// standard route
app.get('/my-page', function(req, res) {
res.send('Hello world!');
});
```Incoming requests to `/my-page/` will be 301 redirected to `/my-page`
## Contributing
Feel free to contribute, either by [raising an issue](https://github.com/john-doherty/express-seo-noslash/issues) or:
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request## History
For change-log, check [releases](https://github.com/john-doherty/express-seo-noslash/releases).
## License
Licensed under [MIT License](LICENSE) © [John Doherty](https://twitter.com/mrjohndoherty)