super-enigma-service is a REST API Service that will give you a quick and easy way to get data from the database.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Download Node.js not lower than version 8.10, Yarn and MongoDB Docker image. Also install and run on your local machine data-worker in order to populate your database.
Clone this repo to your local machine using https://github.com/menkuichan/super-enigma-service.git
Create and add application configuration to .env file in the root of the project:
APP_PORT=3000
DB_URI=mongodb://localhost:27017/super-enigma-db
Use the package manager Yarn to install all the dependencies of super-enigma-service.
yarn install
In the project directory, you can run:
yarn start
Runs the app.
The app will reload if you make changes to the code.
You can use this application without running data-worker every time (if you don't need updated data). You may run data-worker once just for populating the database. But you need MongoDB to always be up and running.
Run your docker image with MongoDB:
docker run --name some-mongo -d mongo:tag
... where some-mongo is the name you want to assign to your container and tag is the tag specifying the MongoDB version you want.
... or run the make utility in the project directory:
make run-mongo
First, make sure that MongoDB is running. Then you need to build a docker image.
make build-image
In the end, run the docker container with server.
docker run -P -d --rm --env TMDB_API_KEY=YOURSECRETAPIKEY --name service-name --link db-name:db image-uri:image-version
... where service-name is the server name, db-name is the database name and so on.
... or run the following command:
make run-service
To stop the service use:
docker stop service-name
... or:
make stop-service
And to stop Docker container with MongoDB use:
docker stop some-mongo
... or:
make stop-mongo
build-image - build an image from a Dockerfile with the service.
run-service - run a docker container with the service.
stop-service - stop running container with the service.
image-publish - push an image with the service to a registry.
run-mongo - run a docker container with MongoDB.
stop-mongo - stop running container with MongoDB.
GET /movies - get a list of movies.
GET /movies/:id - get movie by id.
GET /genres - get a ist of genres.
GET /genres/:id - get one genre by id.