Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from pkrefta/spdy_support
[api]SPDY support via node-spdy
- Loading branch information
Showing
3 changed files
with
74 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// In order to run this example you need to | ||
// generate local ssl certificate | ||
var union = require('../../lib'), | ||
director = require('director'); | ||
|
||
var router = new director.http.Router(); | ||
|
||
var server = union.createServer({ | ||
before: [ | ||
function (req, res) { | ||
var found = router.dispatch(req, res); | ||
if (!found) { | ||
res.emit('next'); | ||
} | ||
} | ||
], | ||
spdy :{ | ||
key: './certs/privatekey.pem', | ||
cert: './certs/certificate.pem' | ||
} | ||
}); | ||
|
||
router.get(/foo/, function () { | ||
this.res.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
this.res.end('hello world\n'); | ||
}); | ||
|
||
server.listen(9090, function(){ | ||
console.log('union with director running on 9090 with SPDY'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters