Build an ASP.net core App and angular from scratch Setup — part 1

Khemlall Mangal
4 min readJul 17, 2022

Hi Guys, my goal is to take you along with me to learn how to build an application using asp.net core, entity framework, angular, typescript, c# and more. As we go along i will introduce how to get setup, and then as we program i will introduce various concepts in programming. This will help you follow along and learn.

We will build a Dating app with Cool feature and then you can apply this skill to build almost anything you imagine. Once you get the idea of how to do something and creating api and learn how to put the pieces together you will be comfortable building anything you want.

Sample app to be built, dating app
Sample of the app to see live status etc

Lets get started.

Setting up Development Server. Lets use .NET core 5.0. the latest is 6.0 and i will show you how to update your startup class etc to be compatible with 6.0 but for now i recommed to follow along with me, install .net core 5.0.

  1. Install .net core 5 — https://versionsof.net/core/5.0/5.0.0/
install .net core 5

2. Install Node Js — https://nodejs.org/en/download/

Visual Studio Code: https://code.visualstudio.com/download

Alright lets start out and create our project folder structure first. Open up command window and navigate to a location where you want to create your project then type → mkdir DatingApp

mkdir DatingApp
Cd DatingApp

Lets use the dotnet command line interface… Check to make sure you have the dotnet sdk is installed.

dotnet --version

Step 1: Create a new solution file

dotnet new sln 

Step 2: Create our api and give it an output directory of API

dotnet new webapi -o API

Step 3: Lets add the api project into our solution… lets use the solution command.

dotnet sln add API/

Let open our project in vscode.

Open up vs code and then open up the folder we just created.

Let’s setup VS code for C# Development

Let add The following Extentions:

  • C# for visual studio code
    - C# Extentions by JosKreativ
    -Material Icon Themes

Now Let first run our application. You can do View → terminal

 Cd API

Let First enable browser to trust the certificate that is provided by the dotnet sdk so we will need to run the following command:

dotnet dev-certs https -- trust

Next lets just run the server now

dotnet watch run 

Without going into too much details let examine the weatherforecast controller and what it means. It using the route controller which is define by the name WeatherForecast. Let go to https://localhost:5001/WeatherForecast and you should see it returns some record.

Navigate to : https://localhost:5001/WeatherForecast

Swagger
https://localhost:5001/swagger/index.html

We were getting an http get request which returns an array of weather forecast.

Lets first go to appsettings.json and change the level of our logging to get more information.

{"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

Lets Quickly talk about our startup class briefly. We have our Configure service often refer to dependency injection container. If we want to make a class or service available to other part of our application. Net core will responsible for the creation and deletion of these service.

Next we have the Configure method. This is use to configure the http request pipeline. Our request goes though a series of middleware on the way in and out. First we check to see if we are in dev mode and return dev exception page. The others are using https redirection, it going to use the routing mechnism to know where to redirect to etc.

Another file we need to look at is Launchsettings.json which tells you where to route to when you start up and provide the url

Alright Now lets start out our application by building out our user entity for our application.

part 2

https://khemlall-mangal.medium.com/build-and-asp-net-core-app-and-angular-from-scratch-creating-our-first-entity-b25cf2f2b9d3

--

--

Khemlall Mangal

I am a passionate coder, QA Engineer, and someone who enjoys the outdoors.