{"id":16416216,"url":"https://github.com/mjhea0/node-docker-api","last_synced_at":"2025-07-14T16:05:59.975Z","repository":{"id":138118029,"uuid":"86194569","full_name":"mjhea0/node-docker-api","owner":"mjhea0","description":"developing and testing microservices with docker","archived":false,"fork":false,"pushed_at":"2017-07-14T23:44:44.000Z","size":505,"stargazers_count":57,"open_issues_count":0,"forks_count":32,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-03T16:52:11.190Z","etag":null,"topics":["docker","microservices","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjhea0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-25T23:18:06.000Z","updated_at":"2023-11-17T06:20:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e794619-5109-43f9-9ec2-b67d0766f027","html_url":"https://github.com/mjhea0/node-docker-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mjhea0/node-docker-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjhea0%2Fnode-docker-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjhea0%2Fnode-docker-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjhea0%2Fnode-docker-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjhea0%2Fnode-docker-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjhea0","download_url":"https://codeload.github.com/mjhea0/node-docker-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjhea0%2Fnode-docker-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265314353,"owners_count":23745251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","microservices","nodejs"],"created_at":"2024-10-11T07:08:43.542Z","updated_at":"2025-07-14T16:05:59.966Z","avatar_url":"https://github.com/mjhea0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Developing and Testing Microservices with Docker\n\n[![Build Status](https://travis-ci.org/mjhea0/node-docker-api.svg?branch=master)](https://travis-ci.org/mjhea0/node-docker-api)\n\n## Want to learn how to build this project?\n\nCheck out the [blog post](http://mherman.org/blog/2017/04/18/developing-and-testing-microservices-with-docker).\n\n## Want to use this project?\n\n### Setup\n\n1. Fork/Clone this repo\n\n1. Download [Docker](https://docs.docker.com/docker-for-mac/install/) (if necessary)\n\n1. Make sure you are using a Docker version \u003e= 17:\n\n    ```sh\n    $ docker -v\n    Docker version 17.03.0-ce, build 60ccb22\n    ```\n\n### Build and Run the App\n\n#### Set the Environment variables\n\n```sh\n$ export NODE_ENV=development\n```\n\nRegister with the [OpenWeatherMap API](https://openweathermap.org/api), and add the key as an environment variable:\n\n```sh\n$ export OPENWEATHERMAP_API_KEY=YOUR_KEY_HERE\n```\n\n#### Fire up the Containers\n\nBuild the images:\n\n```sh\n$ docker-compose build\n```\n\nRun the containers:\n\n```sh\n$ docker-compose up -d\n```\n\n#### Migrate and Seed\n\nWith the apps up, run:\n\n```sh\n$ sh migrate.sh\n```\n\n#### Sanity Check\n\nTest out the following services...\n\n##### (1) Users - http://localhost:3000\n\n| Endpoint        | HTTP Method | CRUD Method | Result        |\n|-----------------|-------------|-------------|---------------|\n| /users/ping     | GET         | READ        | `pong`        |\n| /users/register | POST        | CREATE      | add a user    |\n| /users/login    | POST        | CREATE      | log in a user |\n| /users/user     | GET         | READ        | get user info |\n\n##### (2) Locations - http://localhost:3001\n\n| Endpoint         | HTTP Method | CRUD Method | Result                    |\n|------------------|-------------|-------------|---------------------------|\n| /locations/ping  | GET         | READ        | `pong`                    |\n| /locations       | GET         | READ        | get all locations         |\n| /locations/user  | GET         | READ        | get all locations by user |\n| /locations/:id   | GET         | READ        | get a single location     |\n| /locations       | POST        | CREATE      | add a single location     |\n| /locations/:id   | PUT         | UPDATE      | update a single location  |\n| /locations/:id   | DELETE      | DELETE      | delete a single location  |\n\n##### (3) Web - http://localhost:3003\n\n| Endpoint  | HTTP Method | CRUD Method | Result               |\n|-----------|-------------|-------------|----------------------|\n| /         | GET         | READ        | render main page     |\n| /login    | GET         | READ        | render login page    |\n| /login    | POST        | CREATE      | log in a user        |\n| /register | GET         | READ        | render register page |\n| /register | POST        | CREATE      | register a new user  |\n| /logout   | GET         | READ        | log a user out       |\n| /add      | POST        | CREATE      | add a new location   |\n| /user     | GET         | READ        | get user info        |\n\n##### (4) Locations Database and (5) Users Database\n\nTo access, get the container id from `docker ps` and then open `psql`:\n\n```sh\n$ docker exec -ti \u003ccontainer-id\u003e psql -U postgres\n```\n\n##### (6) Functional Tests\n\nWith the app running, update the `NODE_ENV environment variable and then run the tests`:\n\n```sh\n$ export NODE_ENV=test\n$ docker-compose up -d\n$ docker-compose run tests npm test\n```\n\n\nUpdate `NODE_ENV` when you're ready to develop again:\n\n```sh\n$ export NODE_ENV=development\n$ docker-compose up -d\n```\n\n#### Commands\n\nTo stop the containers:\n\n```sh\n$ docker-compose stop\n```\n\nTo bring down the containers:\n\n```sh\n$ docker-compose down\n```\n\nWant to force a build?\n\n```sh\n$ docker-compose build --no-cache\n```\n\nRemove images:\n\n```sh\n$ docker rmi $(docker images -q)\n```\n\nRun unit and integration tests:\n\n```sh\n$ export NODE_ENV=test\n$ docker-compose up -d\n$ docker-compose run users-service npm test\n$ docker-compose run locations-service npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjhea0%2Fnode-docker-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjhea0%2Fnode-docker-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjhea0%2Fnode-docker-api/lists"}