saka
saka

Reputation: 83

Make Lite-Server run as localhost:3000/parentdirectory and accessible as localhost/parentdirectory

I have an Angular2 app with this file structure:

I am testing the app with the lite-server and it runs beautifully on localhost:3000. To make it work with an Apache proxy I am setting up, I need it to run as locahost:3000/parentdirectory.

Using angular routes, I can easily make my pages look like they are coming from localhost:3000/parentdirectory, but that is only a superficial fix. If I go to localhost/parentdirectory, it still needs to work.

I looked at this question, which I think is very similar: Can't change the base folder for lite-server in Angular 2 application

However, I'm new to all this and I'm afraid of breaking my currently working set-up.

My instinct is that I need to move my lite-server into the parentdirectory and change the root folder to look into my appdirectory, but I'm not sure if that will actually solve my problem.

I am hoping someone can give me concrete instructions or a link to documentation that outlines what I need to do to make this work before I start blindly changing things.

Thank you!

Upvotes: 0

Views: 692

Answers (1)

Arpit Agarwal
Arpit Agarwal

Reputation: 4003

Please try following assuming your application now lives in app folder and server started on it. I.e https://localhost:3000/app 1. index.html set <base href='/app/' /> 2. In bootstrap {provide: APP_BASE_HREF, useValue: '/app/'} // import it from router package 3. In system.config.ts add baseURL: /app/

Upvotes: 0

Related Questions