- Ensure that you have installed .NET Core in your machine.
-
Open a terminal window (e.g. Gitbash, linux terminal, mac terminal, etc) then change directory to your projects folder. Inside the folder, run
dotnet new webapi -o <name of project's folder> -n <project name>
command. Example:dotnet new webapi -o PCShop.Api-n PCShop.Api
. Confirm that the new project is created. -
Change current directory to the new project's directory, and then run
dotnet run
command to run the Web API. Browse tohttps://localhost:5001/api/values
. Confirm that the page displays an array with"value1"
and"value2"
elements.