Search code examples
javascriptnode.jssslhttpsflatiron.js

Node.js Flatiron HTTPS server


Is there a way of using HTTPS connection with Flatiron framework?

Updated: HTTPS server example is available on github now.


Solution

  • var flatiron = require('flatiron'),
        app = flatiron.app;
    
    app.use(flatiron.plugins.http, {
      https: {
        cert: 'path/to/cert.pem',
        key: 'path/to/key.pem',
        ca: 'path/to/ca.pem'
      }
    });
    
    app.router.get('/', function () {
      this.res.writeHead(200, { 'Content-Type': 'text/plain' });
      this.res.end('Hello world!\n');
    });
    
    app.start(8080);