levinhtxbt / dotnet-entrance-test

dotnet-entrance-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Before you get started

Build your first Asp.Net Core API

This test is designed for students who haven't learnt AspNet.Core Web API before or just know little things about AspNet.Core Web API.

Duration: 1 week.

Requirements:

We need to build an application to manage book in the library. Complete the list of items bellow to pass the challenges !!! ⚔️⚔️⚔️

  • Create a web API project.
  • Add a model class and a database context. use InMemory database for testing purposes
  • Seeding default data (list here)
  • Scaffold a controller with CRUD methods.
  • Configure routing, URL paths, and return values.
  • Call the web API with Postman.
  • Use GitHub to manage source code

The following diagram shows the model of the app.

Book Store ERD

Create the following APIs:

Method API Description Response body Example
GET /api/books Get all books (Supports filtering by AuthorId, Rating, and PublishYear) Array of book items detail
GET /api/books/{id} Get an item by ID Book item detail
POST /api/books Add a new item Book item detail
PUT /api/books/{id} Update an existing item None detail
DELETE /api/books/{id} Delete an item None detail
GET /api/authors Get list of author Array of authors with number of books detail

💡 Extra work

  • Add user identity and apply login with JWT
  • Add custom middleware to write logs when requests take more than 500ms.

References

Create your first AspNet.core api

About

dotnet-entrance-test