Coder Social home page Coder Social logo

dotnetcore-webapi's Introduction

DotNetCore Web API - Technical Test

Tentang Project

Ini merupakan project menggunakan Framework ASP .NET Core (6.0) untuk membuat Web Service (Restful API). Dengan skenario penginputan data Employee beserta Department nya.

Entity Relation Diagram (ERD)

Relasi dari kedua entitas adalah (One To Many) - (Many To One). Sebuah Employee hanya dapat memiliki satu Department dan Setiap Department dapat terdiri dari banyak Employee.

Features

  • Validation Request
  • Costume Response Formatter
  • Migration File using Entity Framework
  • Structure Folder (Service & Repository Pattern)
  • Docker File
  • Unit Testing
  • Logger using (SEQ)
  • Auto Mapper
  • Api Doc (Swagger)

Installation

  1. Menjalankan menggunakan Docker yang telah di push / deploy pada DOCKER HUB
1. Untuk repo image bisa di cek disini https://hub.docker.com/r/hafif123/dotnetcore-webapi
2. Bisa langsung menjalankan script pada docker-compose.yml -> `docker compose up`
3. Akses Apps pada URL : http://localhost:8081/swagger/index.html
4. Lakukan migrasi manual, connect pada database postgres dengan credential sebagai berikut
    - UserName : postgres
    - Password : rootuser
    - Host : localhost
    - Port : 5435
5. Setelah itu execute Script SQL yang ada pada Folder `cd WebService.Infrastructure/Migration/Script`
  1. Menjalankan menggunakan Docker Manual
1. jalan kan script di luar folder WebService.API, `docker build -t dotnetcore-webapi -f .\WebService.API\Dockerfile .`
2. masuk pada folder -> `cd WebService.API/ -> docker compose up`
3. untuk tear down / cleaning -> `docker compose down`
  1. Menjalankan Manual di Local Machine
1. masuk ke dalam folder `cd WebService.API/`, lalu jalan kan `dotnet-ef database update`
2. jika ingin tambah migrasi gunakan perintah ini -> `dotnet ef migrations add InitTable -p ..\WebService.Infrastructure`, di dalam folder WebService.API

Import Postman Collection

  1. Menjalankan Unit Testing
1. Di dalam WebService.API terdapat file .json hasil dari export postman `DotNetCore-WebAPI.postman_collection.json`, silahkan di import untuk melakukan API test menggunakan Postman

Unit Testing

  1. Menjalankan Unit Testing
1. Masuk ke dalam direktori WebService.Test
2. Unit Test telah di config agar dapat berjalan secara parralel, untuk menjalankan tuliskan perintah berikut `dotnet test`

Hasil Test Swagger dan Postman serta Docker Image Running

  1. Tampilan Swagger UI (API Doc)

  2. Tampilan Docker Desktop (DotNetCore WebAPI - Postgres)

  3. Tampilan Postman UI (API Test)

  4. Tampilah Hasil Unit Test

dotnetcore-webapi's People

Stargazers

Hafif Nur Muhammmad avatar Pahrurozi avatar M Hidayatullah avatar

Watchers

Hafif Nur Muhammmad 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.