<commit_before>
# subdomain

> Node.JS Express Subdomain Middleware.

I thought that this was a pretty sweet project [express-subdomain-handler](https://github.com/WilsonPage/express-subdomain-handler) but I wanted it crafted a bit differently for my purposes and the ability to force HTTPS and removal of the unneccessary 'www' prefix. Thanks for the inspiration @WilsonPage

```javascript

var subdomain = require('subdomain');

var express = require('express')
  , app = express.createServer();

app.use(subdomain({ base : 'mydomain.com', removeWWW : true }));

app.get('/subdomain/blog/', function(request, response) {
  response.end('<p>blog.mydomain.com</p>');
});

app.get('/subdomain/api/users/', function(request, response) {
  response.end('<p>api.mydomain.com/users</p>');
});

app.get('/hello', function(request, response) {
  response.end('<p>mydomain.com/hello</p>');
});

app.listen(8000);

```<commit_msg>Add a Bitdeli badge to README<commit_after>
# subdomain

> Node.JS Express Subdomain Middleware.

I thought that this was a pretty sweet project [express-subdomain-handler](https://github.com/WilsonPage/express-subdomain-handler) but I wanted it crafted a bit differently for my purposes and the ability to force HTTPS and removal of the unneccessary 'www' prefix. Thanks for the inspiration @WilsonPage

```javascript

var subdomain = require('subdomain');

var express = require('express')
  , app = express.createServer();

app.use(subdomain({ base : 'mydomain.com', removeWWW : true }));

app.get('/subdomain/blog/', function(request, response) {
  response.end('<p>blog.mydomain.com</p>');
});

app.get('/subdomain/api/users/', function(request, response) {
  response.end('<p>api.mydomain.com/users</p>');
});

app.get('/hello', function(request, response) {
  response.end('<p>mydomain.com/hello</p>');
});

app.listen(8000);

```

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/edwardhotchkiss/subdomain/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

{'fraction_non_alphanumeric': 0.1628256513026052, 'fraction_numerical': 0.006513026052104208, 'mean_word_length': 5.319620253164557, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2027727', 'n_tokens_mistral': 655, 'n_tokens_neox': 634, 'n_words': 153}