loading...

re: How to make an API with dotnet core VIEW POST

FULL DISCUSSION
 

I just tried this but there was no ValuesController generated. There was only a WeatherForecastController with just a Get method. There was also no wwwroot generated. I'm running .Net Core 3.0.100 on Windows 10.
I was able to start it and got a result through the browser. Now I can look through the attributes for defining the routes.
Thanks for the post.

 

Hi there Katie, are you using Visual Studio 2019? or are you on VS Code?

 

Not really but I was gonna recommend simply creating the web API project via Visual Studio 2019, since visual studio will template it for you.

Or alternatively using the visual studio 2019 create conroller function, which will create a controller skeleton for you

Odd that the dotnet new webapi did not correctly create your project template.

perhaps if you were to install
dotnet tool install --global dotnet-aspnet-codegenerator

via powershell, more info on that available here and here

In the future, I'll probably scaffold using VS2019. I only did it through the command line to follow the post.

I think I got different results because I'm using a newer version of .NET Core. There is so much stuff here to learn 😄

Could be, I can't say I tried the dotnet new command yet on .NET Core 3.0.

If you'd like I could give it a test at home and let you know my results.

Oh, that's so sweet of you, but it's not really necessary, I've got the gist of what's going on with this. I need to concentrate on building this API for our project. Now at least the structure of how to do it is put together. I'm adjusting things to run async for the rest of the methods.

 

Hi Katie! Thanks for your comment, indeed you have differences because I've used netcore 2.2. I'll clarify this in the post. Nevertheless, the explanation of how it works and what the different annotations mean remains the same.
Thanks again!

code of conduct - report abuse