server.js 545 B

1234567891011121314151617181920
  1. var express = require('express')
  2. var path = require('path')
  3. var compression = require('compression')
  4. var app = express()
  5. app.use(compression())
  6. // serve our static stuff like index.css
  7. app.use(express.static(path.join(__dirname, 'public')))
  8. // send all requests to index.html so browserHistory 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. })