Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated readme #3

Merged
merged 1 commit into from Mar 15, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
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