Which npm webserver can I use when rewriting urls
I am doing a SPA with AngularJS and need a local webserver that supports url rewriting. All queries such as /home
, /profile/1
, /products?id=12
should return the index.html in the root folder. I've tried http-server , local-web-server , but they don't include redirection functionality. I think superstatic should work but for some reason it returns 404 error
source to share
Express allows "*" and also allows regular expressions.
Most of the time in production you will probably need to serve your webapp from nginx or whatever, and the Express api reverse proxy through nginx and bundle them together. nginx will cache much better and the like. (and will probably be much more secure)
However ... Use gulpjs (I think you can grunt too) and then use http://www.browsersync.io/ and https://github.com/shakyShane/browser-sync-spa to reload your interface and it will help you figure it out if you are just frustrated with routing.
source to share