This repository is the node skeleton microservice to create node microservice for WRI API
You will need Control Tower up and running - either natively or with Docker. Refer to the project's README for information on how to set it up.
The FW teams microservice is built using Node.js, and can be executed either natively or using Docker, each of which has its own set of requirements.
Native execution requires:
Execution using Docker requires:
Dependencies on other Microservices:
Start by cloning the repository from github to your execution environment
git clone https://github.com/gfw-api/fw-teams.git && cd fw-team
After that, follow one of the instructions below:
1 - Set up your environment variables. See dev.env.sample
for a list of variables you should set, which are described in detail in this section of the documentation. Native execution will NOT load the dev.env
file content, so you need to use another way to define those values
2 - Install node dependencies using yarn:
yarn
3 - Start the application server:
yarn start
The endpoints provided by this microservice should now be available through Control Tower's URL.
1 - Create and complete your dev.env
file with your configuration. The meaning of the variables is available in this section. You can find an example dev.env.sample
file in the project root.
2 - Execute the following command to run Control tower:
./team.sh develop
The endpoints provided by this microservice should now be available through Control Tower's URL.
There are two ways to run the included tests:
Follow the instruction above for setting up the runtime environment for native execution, then run:
yarn test
Follow the instruction above for setting up the runtime environment for Docker execution, then run:
./team.sh test
It is necessary to define these environment variables:
- CT_URL => Control Tower URL
- NODE_ENV => Environment (prod, staging, dev)
- JWT_SECRET => The secret used to generate JWT tokens.
- API_GATEWAY_URI => Gateway Service API URL
- API_GATEWAY_EXTERNAL_URI
- API_GATEWAY_QUEUE_URL => Url of async queue
- API_GATEWAY_QUEUE_NAME => mail
You can optionally set other variables, see this file for an extended list.
name: <String>
managers: <String>, // array
users: <String>, // array
confirmedUsers: <Object>, // array
areas: <Object> // array
createdAt: <Date>
GET: /team/user/:userId -> Return the teams from the user if it exists
GET: /teams/:id -> Return team with the id
POST: /teams -> Create an team and associate to the user. With body:
#form data
name: "my-team"
managers: [{ id: "userId", email: [email protected] }]
users: ["userId", "userId2", "userId3", ...]
confirmedUsers: [{ id: "userId", email: "[email protected]" } , ...]
areas: ["areaId", "areaId2", "areaId3", ...]
PATCH: /teams/:id -> Update the team with the id
DELETE: /teams/:id -> Delete the team with the id