🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

express-set-domain

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-set-domain

Force an express app to use a particular domain

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
173
-18.78%
Maintainers
1
Weekly downloads
 
Created
Source

express-set-domain

Force an express app to use a particular domain by 301 redirecting none matching requests.

Install

npm install --save express-set-domain

Usage

Add to your express application before all other routes.

var express = require('express');
var app = express();
var setDomain = require('express-set-domain');

// add middleware to force requests to orcascan.com
app.use(setDomain('orcascan.com'));

// typical route
app.get('/docs/integrations/scan-barcodes-into-microsoft-excel', function(req, res) {
    res.send('How to scan barcodes into spreadsheets!');
});

Based on the above example, a request to:

http://www.orcascan.com/docs/integrations/scan-barcodes-into-microsoft-excel

would be 301 redirected to:

http://orcascan.com/docs/integrations/scan-barcodes-into-microsoft-excel

without having to list every potential incoming domain name.

Contributing

Feel free to contribute, either by raising an issue or:

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -m 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

Star the repo

If you find this useful please star the repo, it helps us prioritize which open source bugs to fix :raised_hands:

History

For change-log, check releases.

License

Licensed under MIT License © John Doherty

Keywords

express

FAQs

Package last updated on 27 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts