This API provides several functions that interact with a user database using Firestore. It has a live url and local installation available, provided you have the correct enviroment variables.
https://seahorse-app-mmnsa.ondigitalocean.app
- Clone the repository to your local machine:
git clone https://github.com/CyrisXD/Back-end-Technical-Exercise.git
- Install the dependencies
npm install
- Create your .env file and set up with enviroment variables
Place .env in root folder
Example:
PROJECT_ID=""
PRIVATE_KEY_ID=""
PRIVATE_KEY='""'
CLIENT_EMAIL=""
CLIENT_ID=""
CLIENT_X509_CERT_URL=""
- Run the project
npm run dev
This API contains two endpoints for retrieving and submitting users to the database.
Method: GET
Path: /
curl -X GET \
-H "Content-Type: application/json" \
-d '{"SURNAME": "example"}' \
https://seahorse-app-mmnsa.ondigitalocean.app/users
Method: GET
Path: /users
body payload
{
"SURNAME": "example"
}
curl -X POST \
-H "Content-Type: application/json" \
-d '{"FIRST_NAME": "example", "SURNAME": "example", "EMAIL_ADDRESS": "example@example.com"}' \
https://seahorse-app-mmnsa.ondigitalocean.app/addusers
Method: POST
Path: /addusers
body payload
{
"FIRST_NAME": "example",
"SURNAME": "example",
"EMAIL_ADDRESS": "example@example.com"
}
Perform the integration test by running the test command:
npm run test