Skip to content

Server Routes

Graeme Zinck edited this page Feb 13, 2019 · 6 revisions

Node.js Server Routes

The Angular front-end is able to make the below requests to the Node.js server (which has built-in queries to the database to retrieve the requested data). Note that requests require a payload including the following:

  • In the request header, there must be a key for 'x-access-token' or 'authorization' which is verified to ensure that the user is logged in appropriately/
  • In the body, there must be entries for username and password.

GET requests

  • /user
    Get the information pertaining to a single user
    • f_name
    • l_name
    • email
    • password
    • date_created
    • id
  • /trips
    Get all trips pertaining to a user as an array
    • id
    • name
    • dscript
  • /transportation
    Get all transportation pertaining to a user as an array
    • cost
    • trip_id
    • user_id
    • begin_time
    • end_time
    • loc
    • loc_end
    • method
    • dscript
    • priority
    • completed
  • /accommodations
    Get all accommodations pertaining to a user as an array
    • cost
    • trip_id
    • user_id
    • begin_time
    • end_time
    • loc
    • dscript
    • priority
    • completed
  • /plans
    Get all plans pertaining to a user as an array
    • cost
    • trip_id
    • user_id
    • begin_time
    • end_time
    • loc
    • dscript
    • priority
    • completed

POST requests

  • /trips
    Add a new trip
  • /trips/:tid/transportation
    Add a new transportation item to a user's trip
  • /trips/:tid/accommodations
    Add a new accommodation item to a user's trip
  • /trips/:tid/plans
    Add a new plan to a user's trip

Note: this does not consider the requests for creating a user, etc.

PUT requests

  • /trips/:tid
    Updates a user's trip information
  • /trips/:tid/transportation/:transid
    Updates a transportation item for a user's trip
  • /trips/:tid/accommodations/:accid
    Updates an accommodation item for a user's trip
  • /trips/:tid/plans/:planid
    Updates a plan for a user's trip

DELETE requests

  • /trips/:tname
    Deletes a user's trip
  • /trips/:tname/transportation/:transid
    Deletes a transportation item for a user's trip
  • /trips/:tname/accommodations/:accid
    Deletes an accommodation item for a user's trip
  • /trips/:tname/plans/:planid
    Deletes a plan for a user's trip

Note: this does not consider requests for deleting a user, etc.

Clone this wiki locally