Skip to main content

You have two options.

Create seperateseparate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperationseparation of concerns.
  • You can delploydeploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

How to host and develop the application locally.

An effective solution for development is to use lite-server to run your client (Angular 2) application and IIS / Casini to host your web api code. A good example of how to use it is given in the Angular 2 quickstart tutorial (linked to below). My development process is to run the api through Visual Studio and work with client site coding using Visual Studio Code and lite-server (Atom is another good choice).

From the lite-server docs. Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.

https://code.visualstudio.com/

https://angular.io/docs/js/latest/quickstart.html

https://www.youtube.com/watch?v=e_FVeYWUF3s

https://github.com/johnpapa/lite-server

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of coneptconcept applications. For production releases, I will always seperateseparate my concerns properly and have a dedicated api project.

You have two options.

Create seperate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperation of concerns.
  • You can delploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

How to host and develop the application locally.

An effective solution for development is to use lite-server to run your client (Angular 2) application and IIS / Casini to host your web api code. A good example of how to use it is given in the Angular 2 quickstart tutorial (linked to below). My development process is to run the api through Visual Studio and work with client site coding using Visual Studio Code and lite-server (Atom is another good choice).

From the lite-server docs. Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.

https://code.visualstudio.com/

https://angular.io/docs/js/latest/quickstart.html

https://www.youtube.com/watch?v=e_FVeYWUF3s

https://github.com/johnpapa/lite-server

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of conept applications. For production releases I will always seperate my concerns properly and have a dedicated api project.

You have two options.

Create separate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper separation of concerns.
  • You can deploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

How to host and develop the application locally.

An effective solution for development is to use lite-server to run your client (Angular 2) application and IIS / Casini to host your web api code. A good example of how to use it is given in the Angular 2 quickstart tutorial (linked to below). My development process is to run the api through Visual Studio and work with client site coding using Visual Studio Code and lite-server (Atom is another good choice).

From the lite-server docs. Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.

https://code.visualstudio.com/

https://angular.io/docs/js/latest/quickstart.html

https://www.youtube.com/watch?v=e_FVeYWUF3s

https://github.com/johnpapa/lite-server

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of concept applications. For production releases, I will always separate my concerns properly and have a dedicated api project.

Responded to comment from OP with more detail.
Source Link
CountZero
  • 256
  • 1
  • 7

You have two options.

Create seperate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperation of concerns.
  • You can delploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

How to host and develop the application locally.

An effective solution for development is to use lite-server to run your client (Angular 2) application and IIS / Casini to host your web api code. A good example of how to use it is given in the Angular 2 quickstart tutorial (linked to below). My development process is to run the api through Visual Studio and work with client site coding using Visual Studio Code and lite-server (Atom is another good choice).

From the lite-server docs. Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.

https://code.visualstudio.com/

https://angular.io/docs/js/latest/quickstart.html

https://www.youtube.com/watch?v=e_FVeYWUF3s

https://github.com/johnpapa/lite-server

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of conept applications. For production releases I will always seperate my concerns properly and have a dedicated api project.

You have two options.

Create seperate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperation of concerns.
  • You can delploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of conept applications. For production releases I will always seperate my concerns properly and have a dedicated api project.

You have two options.

Create seperate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperation of concerns.
  • You can delploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

How to host and develop the application locally.

An effective solution for development is to use lite-server to run your client (Angular 2) application and IIS / Casini to host your web api code. A good example of how to use it is given in the Angular 2 quickstart tutorial (linked to below). My development process is to run the api through Visual Studio and work with client site coding using Visual Studio Code and lite-server (Atom is another good choice).

From the lite-server docs. Lightweight development only node server that serves a web app, opens it in the browser, refreshes when html or javascript change, injects CSS changes using sockets, and has a fallback page when a route is not found.

https://code.visualstudio.com/

https://angular.io/docs/js/latest/quickstart.html

https://www.youtube.com/watch?v=e_FVeYWUF3s

https://github.com/johnpapa/lite-server

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of conept applications. For production releases I will always seperate my concerns properly and have a dedicated api project.

Source Link
CountZero
  • 256
  • 1
  • 7

You have two options.

Create seperate mywebsite.api and a mywebsite.app projects in your solution.

Advantages

  • Proper seperation of concerns.
  • You can delploy updates to your api and your front end independently.
  • Architecture of sites can be changed independently (i.e. you can update your api to run on asp.net 5 without affecting the website)
  • Cleaner

Create a single project with both the client app and api in one project

Advantages

  • Easier to deploy updates
  • No need to configure to work with CORS

My view

There is no issue in using Nuget / NPM both in the same solution and this should not inform your choice of project structure.

I only use the single project approach for demo / proof of conept applications. For production releases I will always seperate my concerns properly and have a dedicated api project.