arnaucube
arnaucube/socketioMEANseedPublic Self-hosted repository
socketioMEANseed/www/node_modules/union/examples/simple/spdy.js
www/node_modules/union/examples/simple/spdy.jsRaw
 1// In order to run this example you need to
 2// generate local ssl certificate
 3var union = require('../../lib'),
 4    director = require('director');
 5
 6var router = new director.http.Router();
 7
 8var server = union.createServer({
 9  before: [
10    function (req, res) {
11      var found = router.dispatch(req, res);
12      if (!found) {
13        res.emit('next');
14      }
15    }
16  ],
17  spdy :{
18    key: './certs/privatekey.pem',
19    cert: './certs/certificate.pem'
20  }
21});
22
23router.get(/foo/, function () {
24  this.res.writeHead(200, { 'Content-Type': 'text/plain' })
25  this.res.end('hello world\n');
26});
27
28server.listen(9090, function () {
29  console.log('union with director running on 9090 with SPDY');
30});