'use strict'; const path = require('path'); const config = require('config'); const express = require('express'); const Router = require('express-promise-router'); const { createEngine } = require('express-react-views'); const { fetchReleases } = require('./releases'); function initServer() { const app = express(); const router = Router(); app.set('views', path.join(__dirname, '../../assets/views')); app.set('view engine', 'jsx'); app.engine('jsx', createEngine()); router.get('/', fetchReleases); app.use(router); app.listen(config.web.port, () => { console.log(`Web server listening on port ${config.web.port}`); }); } module.exports = initServer;