Git Product home page Git Product logo

microservice-movies's Introduction

Developing Microservices - Node, React, and Docker

Build Status CircleCI

http://mherman.org/microservice-movies/

Architecture

Name Service Container Tech
Web Web web React, React-Router
Movies API Movies movies Node, Express
Movies DB Movies movies-db Postgres
Swagger Movies swagger Swagger UI
Users API Users users Node, Express
Users DB Users users-db Postgres
Functional Tests Test n/a TestCafe

Want to learn how to build this project?

Check out the blog post.

Want to use this project?

Setup

  1. Fork/Clone this repo

  2. Download Docker (if necessary)

  3. Make sure you are using a Docker version >= 17:

    $ docker -v
    Docker version 17.03.0-ce, build 60ccb22

Build and Run the App

Set the Environment variables

$ export NODE_ENV=development

Fire up the Containers

Build the images:

$ docker-compose build

Run the containers:

$ docker-compose up -d

Migrate and Seed

With the apps up, run:

$ sh init_db.sh

Sanity Check

Test out the following services...

Endpoint HTTP Method CRUD Method Result
/users/ping GET READ pong
/users/register POST CREATE add a user
/users/login POST CREATE log in a user
/users/user GET READ get user info
Endpoint HTTP Method CRUD Method Result
/movies/ping GET READ pong
/movies/user GET READ get all movies by user
/movies POST CREATE add a single movie
Endpoint HTTP Method CRUD Method Result
/ GET READ render main page
/login GET READ render login page
/register GET READ render register page
/logout GET READ log a user out
/collection GET READ render collection page
(4) Movies Database and (5) Users Database

To access, get the container id from docker ps and then open psql:

$ docker exec -ti <container-id> psql -U postgres
(6) Functional Tests

With the containers up running and TestCafe globally installed, run:

$ sh test.sh

Access Swagger docs at the above URL

Commands

To stop the containers:

$ docker-compose stop

To bring down the containers:

$ docker-compose down

Want to force a build?

$ docker-compose build --no-cache

Remove images:

$ docker rmi $(docker images -q)

microservice-movies's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microservice-movies's Issues

API Gateway

Hi!
Wouldn't it be nice to have some API gateway in front of your microservices?
This way your microservices infrastructure would be invisible for consumers (the React App) and you would expose a single service to the world, which internally would communicate with your microservices.
I have doubts if it would be better to use a simple reverse proxy or implement an api gateway myself (in JS or some other language)
Do you have any advices on this subject?

Misused variable

In file: microservice-movies/services/movies/src/app.js
Line: 36
Error: Used err when meaning to use message

const message = req.app.get('env') === 'development' ? err : {};
res.json({ status: 'error', message: err, });

should be

res.json({ status: 'error', message });

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.