Design Doc Review: Backend & Frontend Routes, Components
Opened this issue · 0 comments
RosemaryGonzaga commented
Backend Routes
- Contains the following sections: HTML, API Endpoints(Backend)
- Each route has a description
- API Endpoint routes contains wildcard variables written in
snake_case
- Routes does not contain superfluous routes
- Have API routes that will allow the front end to get all info it needs and does not have unneeded routes:
- probably doesn't need a
GET likes
api endpoint because that info comes through the post show
- probably doesn't need a
Comments
- Add your HTML route (the root route that will fetch your single html page)
- Designate any wildcards in your routes with a colon.
- Transaction routes: You do not need
:user_id
wildcard in these routes; instead, get the user_id from thecurrent_user
's id in the controller. - Watchlist routes:
- When fetching the currently logged in user's watchlist, you do NOT need a
:user_id
wildcard in the route (for a similar reason as described for the transaction routes above) - Similarly, you should not have a
:user_id
wildard in your POST or DELETE routes. Instead, you need a:stock_id
wildcard.- For your
POST
route, the proper way to generate the wildcard is through a nested route. Remember that the "child" resource (the one that "belongs to" the other) should be nested under the "parent" resource. So for this one, the path should be/api/stocks/:stock_id/watchlists
- Your
DELETE
route does not need to be nested, so the path for this would just be/api/watchlists/:id
(where the :id represents the watchlist item's id)
- For your
- When fetching the currently logged in user's watchlist, you do NOT need a
- Consider changing your
:stock_id
wildcards to:ticker_symbol
(depending on what you decide to do with the related feedback on your schema)
Frontend Routes
- Frontend routes contains wildcard variables written in
camelCase
- Correctly formatted
- Routes are displayed with
inline coding text
(backticks)
- Routes are displayed with
Comments
- The root route (
/
), when a user is logged in, should also render the a graph, not just the Portfolio, Watchlist, and Search components. - Note that at the
/stocks/:stockId
, url, the sticky bar with the Portfolio and Watchlist components should also be visible (in addition to the StockShow) - I don't see a frontend route on Robinhood that matches your
/users/:userId
. I do see that the user's account info is rendered at/account
; is that what you meant?