   ca: fs.readFileSync path.join certsPath, 'chain.pem'
 
 if PROD
-  server = https.createServer credentials, app
-else
-  server = app
+  https.createServer(credentials, server).listen 8443, ->
+    logger.info 'HTTPS server listening on port 8443...'
 
 server.listen 8081, ->
   logger.info 'Express web server listening on port 8081...'

    )
    next()

app.use express.static path.resolve __dirname, 'dist'
app.set 'views', './views'
app.set 'view engine', 'jade'

app.get '/index.atom', (req, res) ->
  lang = negotiateLang req
  res.header 'Content-Type', 'application/atom+xml; charset=utf8'
  { store } = createStore()
  init(store, {}, lang).then ->
    articles = articleSelectors.containerSelector(store.getState()).articles


certsPath = path.resolve '/etc/letsencrypt/live/3rdhand.info'

server = express()
server.use favicon './favicon.ico'
server.use(bodyParser.json())
server.use bodyParser.urlencoded extended: true

if DEV
  server.use (req, res, next) ->
    res.header 'Access-Control-Allow-Origin', '*'
    res.header(
      'Access-Control-Allow-Headers'
