Skip to content

Commit

Permalink
Merge pull request #3 from andr3w321/master
Browse files Browse the repository at this point in the history
updated readme
  • Loading branch information
tblobaum committed Mar 15, 2013
2 parents a38ef3a + 570c50b commit b019f2e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,24 +9,35 @@ Subdomains are placed at the beginning of a route by default.


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


// example: api.example.com/user -> '/api/user' // example: api.example.com/user -> '/api/user'


subdomains subdomains
.use('api') .use('api')
.use('other.vanity.domain') .use('other.vanity.domain');


app.use(subdomains.middleware) // Place this line before
// app.use(app.router)
app.use(subdomains.middleware);


// Path for domain/api/user and api.domain/user
app.get('/api/user' function (req, res, next) { app.get('/api/user' function (req, res, next) {
// .. // ..
}) })


app.listen() app.listen();


```` ````


## Testing locally

Add the following line(s) to your /etc/hosts file
```
127.0.0.1 api.localhost
127.0.0.1 other.vanity.domain.localhost
```
## Tests ## Tests
`npm install mocha -g` and `make test` `npm install mocha -g` and `make test`
Expand Down

0 comments on commit b019f2e

Please sign in to comment.