Monday, June 18, 2018

Hosting asp.net core + angular 5 in a single project

edit, forgot to mention in the title this is hosting on azure.

I'm done with writing my app using angular cli, asp.net core api lives in the same project, i figured this would make it easier with deploying it to azure as i use an app service.

I looked at tutorials online on how to deploy this, most of them reference setting up vsts builds, i dont think thats necessary as im the only dev working on this. I'd prefer to just build the solution in release mode, build the angular app in prod mode and ftp the files up.

i did my angular cli build i.e.

ng build --prod

numerous problems when i tested in it IIS, had to configure rewrite rules etc. bit of pain, but i got it working.

since im using an app service which is not iis, i was wondering if there are any good articles or if anyone has experience here deploying an angular 5 app on azure. i figure ill build the angular app locally than ftp it. but you have to set the base href on angular cli build. its something like this. the payload of the build goes into wwwroot. im wondering what to do about rewrite rules, what will the app service do with the web.config in the wwwroot folder?

ng build --base-href /myUrl/

not sure what this url should be, should it be the app service url? im guessing it should be the domain name im pointing to the app service. and i have a feeling this is going to be very painful.

I'm wondering also if it would be easier to separate the angular and core api into two separate projects, but would that require me having two app services for each? ideally i want them in the same app service, the site doesnt get much traffic and its quite light weight anyway.

Hosting asp.net core + angular 5 in a single project Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team