       articles: articles
     )
 
-app.get '/locales/:lang', (req, res) ->
+server.get '/locales/:lang', (req, res) ->
   API.fetchLocaleStrings(req.params.lang).then res.send.bind res
 
-app.get '/signup', (req, res) ->
+server.get '/signup', (req, res) ->
   DB.isSignupAllowed().then (isAllowed) ->
     if isAllowed
       res.format

      else if msg == 'repeat password mismatch'
        res.status(400).send message: msg

app.use '/users', userRouter
app.use '/', siteRouter

app.use (err, req, res, next) ->
  msg = err.message
  if msg == 'session timeout' || msg = 'token expired'
    logger.warn msg

  ca: fs.readFileSync path.join certsPath, 'chain.pem'

if PROD
  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...'
