http-server dist
works great for me on '/' but when using '/foo' it returns a 404. Is there an option for this module to serve 'index.html' by default for all routes?
Or does anyone know of a similar module with this functionality? I'm looking for a server that achieve this without any code (i.e capable from the CLI entirely)
You can try https://github.com/scottcorgan/pushstate-server
It works from CLI and it will server index.html for every route except your static assets
There is also a fork of http-server with implemented fallback
npm install skleeschulte/http-server --save
And then use -f or --fallback parameter:
http-server ./root -f /index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With