CollActionteam / collaction_api

The API powering the Collaction Client Applications
GNU Affero General Public License v3.0
7 stars 0 forks source link

Collaction API

This is the repository for the CollAction API

Getting Started

This section will describe how to get started working with the CollAction API.

Project Requirements

Before we go into the details, make sure you fulfill these requirements:

Note: NPM version used is 7.20.0!

Running Mongo in Docker

If you don't already have an instance of Mongo running, eg. in Docker or otherwise locally, start by fetching the latest image of Mongo and running it in docker:

The command will fetch the latest official image of Mongo from the Docker Hub. The option -d signifies that the Docker container runs in the background, whereas -p signifies the port, allowing you to access mongo at localhost:27017.

Configuring the Service

When all of the dependencies are ready (MongoDB), we can start configuring the service.

First copy+paste the .env.example as .env and make any changes to the environment file as needed.

Note: If you follow the default setup, you should not have to make any changes!

Configuring Firebase (Optional)

If you want, or need, to work with Authentication, you will need to setup Firebase Authentication. We recommend each developer to create a new Firebase Project and use for local development.

Section TBD

Running the Service

If you have not already, run npm ci to install the package dependencies as defined in the package-lock.json file.

Note: To keep the service as stable as possible, we highly recommend you do not use npm install unless you have added new dependencies.

You can now run either the start or watch command, to run the service:

Running the Service in Docker

To run the service in Docker, you must first build the image. You can achieve that simply by doing:

Note: The no cache option is used, in case you have made changes, otherwise Docker builds from cache. This can mean your changes won't be applied.

You will now be able to run the image in a container using the following command:

Note: When accessing another running container, eg. Mongo, you will have to change the ENV variable accordingly.

AWS Required Endpoints

We use AWS S3 buckets to store images used in profiles and crowdactions. The two endpoints that currently require this are:

/api/v1/crowdactions/{id}/images /api/v1/profiles/me/image

To get these credentials contact other developers for the S3 secrets.