saiwolf / TodoAPI

Learning ASP.NET Core Web API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Todo Web API in ASP.NET Core

By Robert Cato

saiwolf@swmnu.net

This project is licensed under the MIT license and copyright to Robert Cato

This is a simple example of me learning how to construct Web APIs using ASP.NET Core 2.1 Web API utilizing Microsoft SQL Server as the DB backend.

The User code was borrowed/modified from this Tutorial by Jason Watmore.

It builds off a simple To-Do API and adds User Authentication via JWT Tokens.

Prerequisites

Instructions

  1. Rename appsettings.json.sample to appsettings.json
  2. Edit appsettings.json to update your connection string for SQL Server and specify a random string for the secret.
  3. In the Package Manager Console (or a shell), change to the directory containing TodoAPI.csproj and run the following:
dotnet restore
dotnet ef database update
Note: dotnet restore will restore the packages outlined in the prerequisites section.
  1. At this point, you should have a table on your SQL Server Instance.
  2. Press F5 in Visual Studio to run the project. You should see IISExpress appear in your system tray.
  3. Navigate to https://localhost:44397/swagger/index.html in your browser (Your port number may vary.)
  4. If all has gone well, you should see the Swagger UI and the display of all the endpoints! Congrats!

About

Learning ASP.NET Core Web API

License:MIT License


Languages

Language:C# 100.0%