Skip to content

A simple WebAPI which manipulates local text files using the Repository and CQS Pattern.

Notifications You must be signed in to change notification settings

Xenoty/SimpleCarWebAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Car Web API

Simple Car Web API Screenshot

  1. Summary
    1. Key Notes
    2. Tech Stack
  2. Getting Started
    1. Requirements
    2. Steps
  3. Design Pattern Choices
    1. Repository Pattern
    2. CQS Pattern

Summary

A simple, self-contained web api to demonstrate how to perform api commands and queries which manipulates different text files. This concept can easily be translated and configured to a local or live database .

Key Notes

  • API documentation is automatically generated using Swagger.
  • Cross-platform with dotnet core
  • Data is contained in text files, attached to the project in the 'Data/' folder.
  • Project runs locally, no configuration needed.
  • Can perform CRUD Actions.

Tech Stack

  1. ASP.NET Core WebAPI

Getting Started

Requirements

Steps

  1. Clone or Fork the repo.
  2. In the downloaded folder, double-click the 'CarWebAPI.sln' file to open the solution.
  3. Run the solution by clicking the green arrow 'CarWebAPI'.

Design Pattern Choices

Repository Pattern

The Repository Pattern was chosen to decouple the data access layer from domain model layer. This decoupling helps remove any dependencies, repitition of logic and enforces separation. This is done through Dependency Injection in which the repositories are only injected into the required domain layers.

The Service layer was excluded from this project, as the service layer adds an extra layer between the Domain and Repository layer. This layer esssentially duplicates the Respostory layer, which requires duplication of code for each new action or query in the repository. Including the service layer will slow down development and require more effort in adding new logic to the repository layer.

CQS Pattern

The CQS Pattern was chosen to seperate the action logic (Create, Update, Delete) from the query logic (Read). This seperates the logic of concern and makes it easier to identify and use. New logic for can be easily added by identifying whether it is a command or query, simplifying the development process. With this seperation it also makes it easier to enforce restricted access for the command logic.

About

A simple WebAPI which manipulates local text files using the Repository and CQS Pattern.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages