AspNet Tutorial - Create Web.Api 2 in 2018!

Preface

This tutorial is to help guide you to create, for yourself, a brand new spanking Web.Api, based in AspNet, using JWTokens, Claims/Roles, Dependency Injection, and SwaggerUI!

You might think - "Hey HouseCat, there are a ton of prebuilt templates out there to use, why not use one of them?". Good question me. To answer that it's simple, configuring one yourself is a great API learning experience. I also have to admit, often something a lot of developers don't have to do. Maintain one sure, but to build a semi-lightweight Web.Api from scratch? Not many junior / midlevel developers get the experience with design.

Why is this in Asp.Net and not NetCore? Business requirements.


Getting Started

Used In This Tutorial
Who Is This Tutorial Aimed At
Who Is This Tutorial Not Aimed At

This guide is how to build a Web.Api and explain what we are doing in the simplest terms. This is not a spec sheet or whitepaper on how to API. There are great resources on explaining every intricate part already. This guide is the simple quickplay guide that will show you how to get tinkering ASAP.


Part 1 - Create A New Solution

Step 1.) Create New Project Menu

Make sure it still builds after all the NuGets are installed... not joking. All this extra stuff is for MVC. If you created a Empty project with Web.API you will not have to do as much.

Part 1 (w/ MVC) - Create A New Solution

We are demonstrating how create one API from emtpy template.

Step 1.) Create New Project Menu


Step 2.) Next Menu


Step 3.) Make Sure It Builds


Step 4.) Update NuGet Packages




Part 1 (w/ MVC) - Create A New Solution

We are demonstrating how create one API w/ MVC, but we will not be using this demo in our examples.

Step 1.) Create New Project Menu


Step 2.) Next Menu


Step 3.) Make Sure It Builds


Step 4.) Update NuGet Packages




Make sure it still builds after all the NuGets are installed... not joking. All this extra stuff is for MVC. If you created a Empty project with Web.API you will not have to do as much.