Git Product home page Git Product logo

orderingmicroservice's Introduction

OrderingMicroservice

This is an example of a very simplified ordering system made in a microservice architecture using .NET 5

Overview

This project consists of following partitions

  • AppGateway
  • CustomerService.Api
  • CustomerService.Application
  • CustomerService.Test
  • OrderService.Api
  • OrderService.Application
  • OrderService.Test

AppGateway

AppGateway is a microservice that responsible for communication with other services.

This service includes:

  • Ocelot is used for Gateway implementation
  • Containerization
Endpoint Allowed Methods Description
/customers Post, Put, Get, Delete Customer microservice
/orders Post, Put, Get, Delete Order microservice

CustomerService.Api

Customer microservice that responsible for basic CRUD implementations over Customer Entity.

This service includes:

  • .NET 5 Web Api implementation
  • REST API Principles, CRUD operations
  • PostgreSQL as Database Provider
  • Repository Pattern implementation
  • Containerization
Endpoint Method Description
/api/Customer Get List all customers
/api/Customer/{id} Get Get customer
/api/Customer Post Insert customer
/api/Customer/{id} Put Update customer
/api/Customer/{id} Delete Delete customer

OrderService.Api

Order microservice that responsible for basic CRUD implementations over Order Entity.

This service includes:

  • .NET 5 Web Api implementation
  • REST API Principles, CRUD operations
  • PostgreSQL as Database Provider
  • Repository Pattern implementation
  • Containerization
Endpoint Method Description
/api/Order Get List all orders
/api/Order/{id} Get Get order
/api/Order Post Insert order
/api/Order/{id} Put Update order
/api/Order/{id} Delete Delete order
/api/Order/{id}/change-status Put Update order status

Run The Project

You will need the following tools:

Installing

Follow these steps to get your development environment set up: (Before Run Start the Docker Desktop)

  1. Clone the repository
  2. (Optional) If you want, you can limit the Wsl2's memory and cpu usage. (see also)
  • Go to User's Document Folder ( Press "WinKey + R" and run "%UserProfile%" )
  • Create a file named .wslconfig
  • Write its content as follows (Windows restart may be required)
[wsl2]
memory=8GB
processors=2
swap=0
localhostForwarding=true
  1. At the root directory which include docker-compose.yml and docker-compose.override.yml files, run below command:
docker-compose -f docker-compose.yml -f docker-compose.override.yml up
  1. Wait for docker compose all microservices.

  2. You can launch microservices as below urls:

If you want to use the API with Postman, click below link.

Run in Postman

Testing

To run unit tests, you have to run microservices with test environment. We will also use Docker for unit tests.

  1. At the root directory which include docker-compose-tests.yml and docker-compose-tests.override.yml files, run below command:
docker-compose  -f docker-compose-tests.yml -f docker-compose-tests.override.yml up
  1. Wait for docker compose all microservices.
  2. From the Test menu item, run the all tests.

image

  1. Open the Test Explorer window, and notice the results of the tests.

image

orderingmicroservice's People

Contributors

myerden avatar

Stargazers

 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.