Skip to content

Frontend Routes

Zachary Duvall edited this page Jan 5, 2021 · 41 revisions

User-facing routes

/users/login

Login Page

Routes Used

  • GET /users/login -- show form to login
  • POST /users/login -- login user

/users/logout

Logout button in navbar, authentication required to access

Route Used

  • GET /users/logout -- logout user

/users/signup

Sign Up page

Routes Used

  • GET /users/sign-up -- show form to create user
  • POST /users/sign-up -- create user and login user

/users/:id

Authentication required to access

Navigation bar, forest with list of trees

Routes Used

  • GET /users -- list all users without details (just userName and climber score), default ordered by PK
  • GET /users/:id -- show user page with their climber score and forest (all trees marked as "climbed" or "want to climb")

See API Documentation for details on toggling between "climbed" and "want to climb"

Stretch Route

  • GET /users/:id/reviews -- show all reviews a user has written

/trees/:id

Authentication required to access

Navigation bar, list trees, details for specified tree, review tree, mark tree (add to forest as climbed or want to climb)

  • Stretch: Tree edit form, tree delete button

Routes Used

  • GET /trees -- list all trees without details (just name and avg scores), default ordered by PK (essentially our home page)
  • GET /trees/new -- show form to create tree
  • POST /trees -- create tree
  • GET /trees/:id -- show specified tree with details (description, location, avg ratings, corresponding reviews...)

Stretch Route

  • GET /trees/:id/edit -- show form to edit tree

See API Documentation for details on marking trees as "climbed" or "want to climb"

/reviews

Authentication required to access

Navigation bar, form to review a tree

Routes Used

  • GET /reviews/new -- show review form
  • POST /reviews -- create review

.pug files

  • layout.pug for nav bar (all pages extend this)
  • utils.pug for:
    • tree mixin for undetailed view of a tree
    • validationErrorSummary mixin for displaying errors
    • field mixin for creating fields in our forms
  • Trees
    • all-trees.pug to view list of all trees (use tree mixin) -- GET /trees
    • tree.pug to view details of a specific tree -- GET /trees/:id
    • create-tree.pug to view form to create a new tree (use validationErrorSummary mixin and field mixin) -- GET /trees/new
    • review-tree.pug to view form for creating a review (use validationErrorSummary mixin and field mixin) -- GET /reviews/new
  • Users
    • user.pug to view user’s forest and climber score (use tree mixin) -- GET /users/:id
    • login.pug to view form to login (use validationErrorSummary mixin and field mixin) -- GET /login
    • sign-up.pug to view form to register/create a user (use validationErrorSummary mixin and field mixin) -- GET /signup
    • highest-climber.pug (stretch goal) to view all users ranked by climber score -- GET /users

Clone this wiki locally