Skip to content

About

Easily manage and delegate routes to certain subdomains.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Subdomains for Express

NPM

Easily manage and delegate routes to subdomains.

Usage

Example express boilerplate:

const express   = require('express')
const subdomain = require('subdomain-wizard')
const app       = express() 

Basic usage

app.get(subdomain('foo', app, function(req, res){
    res.send('Hello there')
}))

// Visit: foo.example.com
// Hello there

Use wildcard (*)

app.get(subdomain('*.foo', function(req, res){
    res.send('Hello pretty')
}))

// Visit: foo.example.com
// Hello pretty

// Visit: bar.foo.example.com
// Hello pretty

Caveat

If your domain is ending at a second level TLD like .co.in, then use app.set('subdomain offset', 3) before using subdomain.

Refer Express docs for more information.

Licensing

Licensed under MIT License.

About

Easily manage and delegate routes to certain subdomains.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages