server.js 575 B

12345678910111213141516171819
  1. var express = require('express');
  2. var path = require('path');
  3. var compression = require('compression');
  4. var app = express();
  5. app.use(compression());
  6. // Server our static stuff like index.css
  7. app.use(express.static(path.join(__dirname, 'public')));
  8. // Send all requests to index.html so browserHistory in React Router works
  9. app.get('*', function (req, res) {
  10. res.sendFile(path.join(__dirname, 'public', 'index.html'));
  11. });
  12. var PORT = process.env.PORT || 8080;
  13. app.listen(PORT, function () {
  14. console.log('"Production" Express server running at localhost:' + PORT);
  15. });