environment variables are handled through dotenv package. You can add a .env file to the root of the project and add DB_HOST and GOOGLE_APPLICATION_CREDENTIALS variables. DB_HOST will be the URL for the mongoDB cluster which you can find on the mongoDB atlas portal. GOOGLE_APPLICATION_CREDENTIALS is the path to the firebase service account keys you can download from firebase.
Login will happen client side and firebase will give you an authorization token. (user.tokenID or something similar)
This token should then be passed in the Authorization section of every request. (Example: "Bearer: TOKEN"). This will make sure only authorized persons can access a resource.
Creates a user when authenticated through Google/Facebook
Request JSON:
{
name: String,
email: String,
location: city id,
}
Creates a user when authenticated through email/password
Request JSON:
{
name: String,
email: String,
password: String,
location: city id,
}
:id - Mongo User ID
Retrieves a user by the id
:id - Firebase User Id
Retrived a user by id
:userId - User ID
Adds route to users forked routes
Request JSON:
{
routeId: String,
}
:userId - User ID
Returns user's forked routes
:userId - User ID
Returns user's liked routes
:userId - User ID
Returns the user's created routes
Adds a new city to the db
Request JSON:
{
name: String,
placeId: String,
photoRef: String
}
Retrieves the cities in the db
:id - City ID
Retrieves a city by its id
Adds a new route and its respective pins to the db
Request JSON:
{
name: String,
creator: user id,
city: city id,
pins: [{
name: String,
coordinates: [Number, Number],
description: String,
}]
}
:id - Route ID
Retrieves a route by its id
:id - Route ID
Deletes a route by its id
Retrieves up to 20 routes
:id - City ID
Retrieves up to 20 routes from the city specified
Retrieves up to 10 routes in the city by tag
:id - City ID Query Params: tag - the tag you want to query by page - how many routes you have so far recieved
Retrives up to 10 routes within ten miles of the lng and lat
Query Params: lng - the longitude lat - the latitude tag - the tag you want to query by page - how many routes you have so far recieved
Likes or unlikes a route. Adds or removes route from user's liked routes.
:routeId - Route ID
Body:
{
"type": "like" or "unlike",
"userId": "insert_user_id"
}