Stackedit/index.js
2018-01-19 23:32:14 +00:00

21 lines
502 B
JavaScript

const env = require('./config/prod.env');
Object.keys(env).forEach((key) => {
if (!process.env[key]) {
process.env[key] = JSON.parse(env[key]);
}
});
const http = require('http');
const express = require('express');
const app = express();
require('./server')(app, process.env.SERVE_V4);
const port = parseInt(process.env.PORT || 8080, 10);
const httpServer = http.createServer(app);
httpServer.listen(port, null, () => {
console.log(`HTTP server started: http://localhost:${port}`);
});