Skip to content

Backend Routes

Wayne Su edited this page Apr 27, 2020 · 4 revisions

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • POST /api/users - Sign up

Session

  • POST /api/session - Sign in
  • DELETE /api/session - Sign out

designs

  • GET /api/designs - Get designs for currentUser/folder/public_templates, can be filtered via ajax data/params by userId/folderId/title/tags
  • GET /api/designs/:id - Get specific design for Editor
  • POST /api/designs - Create a new design
  • PATCH /api/designs/:id - Update design or design meta data (does update include elements on the design?)
  • DELETE /api/designs/:id - Remove specific design

How do I get the templateModal to use the same show controller? should I have another api/template controller(w/o model)?

elements

  • GET /api/designs/:design_id/elements - Get all elements on this design
  • GET /api/elements/:id - Get all properties on the element (joins)
  • POST /api/elements - Create an element (could it post to mutilple tables with one controller?)
  • PATCH /api/elements/:id - Update an element
  • DELETE /api/elements/:id - Delete an element

The POST, PATCH, DELETE, could it also update other table's entries tied to the element? e.g. if I updated a shape's width, can I update both elements & shapes table in the same API call?

stockphotos

  • GET /api/stockphotos - Get all available stockphoto, can be filtered via ajax data/params by tags/title
  • GET /api/stockphotos/:id - Get more info on a specific stockphoto, tags association, recommended association

uploaded_images

  • GET /api/uploaded_images - Get all uploaded images for current user
  • GET /api/uploaded_images/:id - Get more info on a specific image
  • POST /api/uploaded_images - Upload a new image
  • PATCH /api/uploaded_images/:id - Update metadata for a specific image
  • DELETE /api/uploaded_images/:id - Remove a specific image

likes

  • POST /api/likes - Add like to a stockphoto/public design(template)
  • DELETE /api/likes/:id - Remove like

tags

  • GET /api/tags?design - Get available tags for templates
  • GET /api/tags?stockphoto - Get available tags for stockphotos

I should seperate the two kinds of tags into different tables shouldn't I?

tag_connections

  • POST /api/tags - Add tag to a design
  • DELETE /api/tags/:id - Remove tag

folders

  • GET /api/folders - Get folders for currentUser
  • POST /api/folders - Create a new folder
  • PATCH /api/folders/:id - Rename a folder
  • DELETE /api/folders/:id - Remove folder

How do I manage static folders that are created for each user? e.g. all-designs/likes/(shared)/uploads/purchased/trash

Clone this wiki locally