This is a web service made up of two docker containers:
- db - (postgres)
- web - (nodejs)
The orchestration of which is controlled by a docker-compose file.
- Select the environment you want to run and edit the
web.enironment
setting in thedocker-compose.yml
file to one of the settings below:
Environment | Setting | Description |
---|---|---|
Production | NODE_ENV=PROD |
Runs API using PM2 with watch flag disabled |
Development | NODE_ENV=DEV |
Runs API using PM2 with watch flag enabled |
Testing | NODE_ENV=TEST |
Runs an automated test suite on the API using mocha & chai |
- Run
docker-compose build
- Run
docker-compose up
The API runs on http://localhost:3000
and has 3 methods
- POST message -
http://localhost:3000/messages/FOOBAR
- GET messages -
http://localhost:3000/messages/
- GET message -
http://localhost:3000/messages/1
Once th environment is up and running you can inspect the database by inspecting the docker container for the databases host:
-
docker inspect amigo_db_1
and connecting to the database via PGAdmin using theIPAddress
and the following username and password: -
Username: amigo
-
password: password123