I am using lite-server to help with the development of ng2 apps (to which I am new). It refreshes my index.html in the browser whenever changes are made in the project.
But what in the case where I'm dealing with index.php? Before I'd serve it through my LAMP stack.
How can I combine the ease of use of lite-server when developing ng2 apps with the need for php compilation? Is there some configuration that I can adjust in lite-server for it to launch a different URL for instance (that points to apache instead of localhost:3000)? I checked the readme, but it doesn't mention something like this, nor can I find something with a google search.
updated answer
I updated the answer, because it is not working as expected with the proxy-middleware. I tried the connect-modrewrite instead, which is working as expected.
First, you need to install the middleware like this:
npm install connect-modrewrite --save-dev
Then you can add the rule like this in your browserSync config:
middleware : [
require('connect-modrewrite')([
`^/$ ${BACKEND_HOST}${BACKEND_URI}index.php [P]`
])
]
old answer
You can add the http-proxy-middleware. With it, it should be possible to rewrite the index to your apache index.
You can find an example of adding a middleware to lite-server here: https://github.com/johnpapa/lite-server#custom-configuration
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