Search This Blog

Saturday 25 March 2017

ASP WebApi Core and Angular 2

Hi ,

We will enjoy together to start a new project using .Net Core Web Api and Angular 2 , new challenge and a new world for ones whose have never had any contact with open source technologies or one different environment.

So lets pratique.

Prerequisites

NodeJS (NPM)
https://nodejs.org/en/download/

. Net Core
https://www.microsoft.com/net/core#macos

Yeoman (via command line in your terminal or prompt)
npm install -g you

In my lab I am using Visual Studio Code , but you could use any IDE or prompt you prefer.
https://code.visualstudio.com

Start kit Angular 

Basically for this test proposal we are going to use the template base just to initial test and then I going to use one simple project to demonstrate the powerful feature it is Angular 2.

Install the scaffold to generate asp net core via terminal
 npm install -g yo generator-aspnetcore-spa 

go to the folder which you want save the files ou create a new one and then command to start the scaffold.
 yo aspnetcore-spa 



and finally

  dotnet restore   

  npm install    

  dotnet run  

Use the navigator to browse http://localhost:5000



Should show the default angular start kit.

Conclusions

One of many problems which I have during my experience using Angular it was extremely difficult find one template stable enough to start to work and runnable in different OS, I am using these in my projects it working quite well.

See you next post.

References 

https://github.com/aspnet/JavaScriptServices




Translate