API Description Sprint 2 - Bartan02/positive-health-int-team-2 GitHub Wiki

API gateway microservice

/auth - proxy to Authentication microservice

/activities - proxy to Activities microservice

GET /test - simple test path

REQ: ---

RES: BODY:: "Api gateway works!"

Authentication microservice

POST /auth/register

REQ: BODY: { email, username, password}

RES: BODY: { token, redirect: "/logintest"}

POST /auth/login

REQ: BODY: { email, username, password}

RES: BODY: { token, redirect: "/logintest", user;id: user.id}

POST /auth/logout

REQ: HEADER: Authorization

RES: BODY: { message: "Logout successful", redirect: "/"}

GET /auth//logintest

REQ: HEADER: Authorization

RES: BODY: {message: 'Profile accessed successfully', redirect: '/logintest'}

GET '/auth/getuserid'

REQ: HEADER: Authorization

RES: BODY: {userId}

GET /test

REQ : ---

RES: BODY: It works

Map service

POST /create-meeting - about creating a new meeting

REQ: { activity, meetingStartTime, meetingEndTime, latitude, longitude, skillLevel}

{ message: 'New meeting created', meetingId: result.insertId }

GET /get-all-meetings - get all meetings in the database

REQ: ---

RES: BODY: { meetings: rows }

Activities microservice

POST /activities/start/

REQ: { userId, startLocation }

RES: { activityId, message: 'Activity successfully started' }

POST /activities/stop/

REQ: { activityId, maximumSpeed }

RES: { distance: 201, totalTime: 234, maximumSpeed: 24, message: 'Activity stopped successfully', }

POST /activities/update-location/

REQ: { activityId, currentLocation, maximumSpeed }

RES: BODY { distance: 203, message: 'Location updated successfully', maximumSpeed: 24 }

GET /activities/records

REQ: ---

RES: BODY: { "activity_id": "0ei0o54y4", "user_id": "1234", "start_time": "2023-12-07T11:38:49.000Z", "start_location": { "latitude": 51.494520362514855, "longitude": 3.615577183667212 }, "distance": 17.939830223382586, "last_location": { "latitude": 51.494571554873374, "longitude": 3.61554948608949 }, "maximum_speed": 21 }