3
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)

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.