The crimemap-sync-api is a GraphQL API that exposes services for importing crime data to a crime map database. Use crimemap-sync-cli to consumes these services.
The crimemap-sync-api is dockerized, so you need to have docker and docker-compose installed in your machine to raise the API server.
Once you have docker and docker-compose installed, now you need to declare the server infrastructure inside a docker-compose.yml file and create a shell script to initialize the database. Fortunately we create samples of this files to you just download and customize and use it. So, download these files docker-compose.yml and init.db.sh to same directory and run the command below inside this directory:
$ docker-compose up -d
Creating network "crimemap_network_api" with driver "bridge"
Creating volume "crimemap_database_files" with default driver
Creating volume "crimemap_database_config" with default driver
Creating database ... done
Creating api ... done
In the docker-compose.yml you can configure the crimemap-sync-api just setting some environment variables. Here we have the environment variables that you can use:
NODE_ENV
Use this variable to tell the application where is the environment that it's running on. All possible values are development, testing, and production.
DEBUG
We set a lot of debug logs through the code. All debug logs had a name to identify them and you can use this environment variable to enable/disable debug logs by name. You can enable all debug logs just setting an * (asterisk) or setting a list of debugging names separated by space or comma. To know more about it, see the debug README.me file.
JWT_KEY
We are using JSON Web Token to authorize users to get access to crimemap-sync-api. To generate a JWT authorization token we need a secret KEY and you can enter it here.
CORS_CLIENT_ORIGIN
Here you can set the domain name the can access this API. Use a * (asterisk) to grant access to all domains. Click in the next link to know more about cross-origin resource sharing (CORS).
DB_HOST
The hostname of the database server.
DB_PORT
The database port. The mongo database default port is 27017.
DB_NAME
The database name where the api application will storage data.
DB_USER
The database username that you created in the database initialization script.
DB_PASS
The database password that you created in the database initialization script.
MIT © paulosales.
Content type
Image
Digest
Size
159.8 MB
Last updated
over 6 years ago
docker pull prsales/crimemap-sync-api