0

Please or Register to create posts and topics.

Why are both Angular and WebAPI combined into a single project?

Hi,

I was wondering why both the web API and the Angular website within the quickapp were combined into a single web application. Would it not be better to have them separated into one web application for the API, one for the frontend and a third for the DAL?

We could then also make changes and additions to the API independently saving recompile time as well.

Best regards,

Arjan.

Hello Arjan,

We do this to keep things simple.
We keep the ClientApp and the WebAPI which drives the ClientApp in the same project, whilst we separate app logic and database related operations into the DAL.
The starting project is simple enough to have just these 2 separations and you SHOULD add more projects as your Business logic dictates. The idea is to have something simple to get you started and adopt it to your taste as your project demands.

Keep in mind the ClientApp folder is a separate self contained angular project that is capable of being managed independently even though it resides in the main project.

If you preferred you could move it into another project and point your main project to it and still benefit from the seamless integration.
Steps:

  1. Create a new project in the solution
  2. Add the line "<DefaultItemExcludes>$(DefaultItemExcludes);$ClientApp\node_modules\**</DefaultItemExcludes>" to the CSPROJ file of the new project
  3. Move the ClientApp folder into the new project
  4. Point spa.Options.SourcePath in Startup.cs to the new location. E.g. spa.Options.SourcePath = "../FrontEnd/ClientApp";
  5. Update the locations of ClientApp in the main project's CSPROJ file to point to the new location

 

Regards,
Eben Monney