Dotnet Core WebAPI Development Learning (1)
See the link below to learn how to create HelloWorld blog.csdn.net/qq_36051316…
Enter the desktop:
cd desktop
md TestApp
cd TestApp
dotnet new webapi
Copy the code
Open our vscode, you can also create in our vscode
Find the Controllers folder
Create a file (controller) : TestController
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace testApp2.Controllers { public class TestController : ControllerBase {[Route(" API /test/get")] [HttpGet] Public Object get (int I) {system.console.WriteLine(" The API/test/get: "+ I); Return "Congratulations! The number you entered is :"+ I; }}}Copy the code
At this point, enter the run code at the terminal: dotnet run
Access API address:
https://localhost:5001/api/test/get
We find that the access interface is successful ~ as shown below
Welcome to qq group communication: 704028989