react-dazzle
Version:
The simple yet flexible dashbording solution for React
35 lines (27 loc) • 888 B
JavaScript
const express = require('express');
const winston = require('winston');
const helmet = require('helmet');
const nodeProxy = require('./node-proxy');
const nodeAppServer = require('./node-app-server');
/**
* Heroku-friendly production http server.
*
* Serves your app and allows you to proxy APIs if needed.
*/
const app = express();
const PORT = process.env.PORT || 8080;
// Enable various security helpers.
app.use(helmet());
// API proxy logic: if you need to talk to a remote server from your client-side
// app you can proxy it though here by editing ./proxy-config.js
nodeProxy(app);
// Serve the distributed assets and allow HTML5 mode routing. NB: must be last.
nodeAppServer(app);
// Start up the server.
app.listen(PORT, (err) => {
if (err) {
winston.error(err);
return;
}
winston.info(`Listening on port ${PORT}`);
});