Skip to content

backend routes

ziqi23 edited this page Apr 20, 2023 · 4 revisions

API Endpoints (Backend Routes)

  • users

    • POST /api/users - sends user inputted login data to backend and perform authentication
  • session

    • GET /api/session - stores CSRF token and returns the logged-in user's information
    • POST /api/session - log in
    • DELETE /api/session - log out
  • journals

    • GET /api/journals - retrieves journals for the user currently logged in
    • GET /api/journals/:id - retrieves specific journal by id as well as the pages contained within each journal
    • POST /api/journals - creates a new journal
    • PATCH /api/journals/:id - updates an attribute within an existing journal (name, icon, favorite status, whether or not shared, etc.)
    • DELETE /api/journals/:id - deletes an existing journal
  • pages

    • GET /api/pages/:journal_id - retrieves all pages for a specific journal
    • POST /api/pages - creates a new page
    • PATCH /api/pages/:id - updates the html content within a page (note: changing one page may change all other pages)
    • DELETE /api/pages/:id - deletes an existing page
  • comments

    • GET /api/comments/:user_id - gets all comments addressed to a particular user
    • POST /api/comments - creates a new journal
    • DELETE /api/comments/:id - deletes an existing comment
  • teams

    • GET /api/teams/:user_id - gets all teams relevant to a particular user
    • POST /api/teams - creates a new team
    • DELETE /api/teams/:id - deletes an existing team