Giter Site home page Giter Site logo

go-services's Introduction

GO SERVICES

This is an attempt to setup 3 go services and a RabbitMQ connection in a docker environment.

User Service

The User Service is a simple service that returns a user object based on specified user IDs. The service also simulates some delays and faults that should be handled in the order service.

Product Service

The Product service is another simple service with three fixed products that are retrieved by their product codes. This service also some delays and faults

Order Service

The Order Service is a more extensive service the receives a POST request containing a user ID and product code, fetches the corresponding data from the user and product services, saves the order, and then publishes a message to RabbitMQ. Sample create order request body:

{
    "user_id": "e6f24d7d1c7e",
    "product_code": "product1"
}

Setup Guide

Requirements

  • Docker

Instructions

  1. Clone the repo and in each service, make a copy of .env.sample as .env and update the environment variables as you deem fit
git clone https://github.com/mhope-2/go-services.git
cp .env.sample .env
  1. Start the services in a docker environment
docker-compose up

or

make up

Running Tests

For the user and product services:

go test -v -cover ./...

For the order service, since the dependencies (Postgres and RabbitMQ) aren't completely isolated in the tests as disposable docker containers, you'll have to keep them up before running the test command

go-services's People

Contributors

mhope-2 avatar

Stargazers

Kwesi Ansah 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.