GithubHelp home page GithubHelp logo

net8webapiworkshop's Introduction

.NET 8 Web API

logo
Building a Web API with .NET 8

Setup

The following tools are required to build and run this project:

  • .NET 8 SDK
  • A Code editor like Visual Studio Code
  • A browser of your choice that supports JavaScript and WebAssembly (so everything except Internet Explorer 11)

What is in the box?

There are three projects in this repository:

  • ExpenseTracker: A .NET 8 Web API project that serves as the backend for the frontend project.
  • Frontend: A Blazor WebAssembly project that serves as the frontend for the Web API project.
  • ExpenseTracker.Tests: A .NET 8 xUnit project that contains unit tests for the Web API project (WebApplicationFactory).

The whole application is a simple Expense Tracker (CRUD application) that allows you to add, edit, delete and view expenses. It uses a SQLite database to store the expenses (via Entity Framework Core) and SignalR to notify the frontend when the expenses are updated.

There are two branches:

  • main: Contains the final version of the application. So everything is already implemented.
  • ui-only: Contains the frontend project only. So you can implement the backend yourself.

But it would be nice to understand the single steps - therefore there are some branches that incrementally go from ui-only to main:

  • step-1: This branch adds the Web API project and the first controller via Minimal API. The controller returns a static list of expenses. It also includes CORS to make the frontend work!.
  • step-2: Adding Entity Framework with SQLite to enable retrieval via the database.
  • step-3: Implementing the POST request, so that the client can easily add new expenses and return them.
  • step-4: Implementing the PUT request, so that the client can easily update existing expenses.
  • step-5: Implementing the DELETE request, so that the client can easily delete existing expenses.
  • step-6: Moving everything to its own small file to cleanup "the mess".
  • step-7: Adding SignalR to notify the frontend when the expenses are updated.
  • step-8: Adding logging and our own first middleware
  • step-9: Adding the global exception handler
  • step-10: Adding the Tests (WebApplicationFactory)

net8webapiworkshop's People

Contributors

linkdotnet avatar

Stargazers

Volker Milbrandt avatar 고형호 avatar Lee Seung Hu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.