server.js 351 B

123456789101112131415
  1. const express = require('express')
  2. const history = require('connect-history-api-fallback')
  3. const app = express()
  4. const httpPort = 3000
  5. const middleware = history(
  6. {
  7. index: '/index.html'
  8. }
  9. )
  10. app.use(middleware)
  11. app.use(express.static('dist'))
  12. app.listen(httpPort, () => {
  13. console.log('Server listening on: http://localhost:%s', httpPort)
  14. })