0

I have an Angular2 app with this file structure:

  • ParentDirectory
    • AppDirectory
      • app
        • app.component etc
      • node-module
        • @angular
        • lite-server
        • etc
      • index.html
      • styles.css
      • etc

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!

Community
  • 1
  • 1
saka
  • 83
  • 2
  • 9

1 Answers1

0

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/

Arpit Agarwal
  • 3,993
  • 24
  • 30
  • Thank you for the suggestion. That seems to affect where my app is looking for its files, but not where the lite-server is running. The effect is an error that: GET http://localhost:3000/app/app 404 (Not Found). I also tried it using the '/appdirectory/' name instead of 'app' but had the same results. – saka Jul 06 '16 at 16:30
  • Start lit server form parent directory – Arpit Agarwal Jul 06 '16 at 17:11