You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
694 B

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