KyleBibler / responses

Apache License 2.0
0 stars 0 forks source link

Discuss site route structure #6

Open KyleBibler opened 8 years ago

KyleBibler commented 8 years ago

Please comment below some ways you think the routing of the site should work, e.g., "/" [index page] - Contains site info "/lobbies/" [lobbies page] - Contains a list of all lobbies and functionality for general lobby functions not specific to a single lobby "/lobbies/:lobbyId/" ...etc.

The above list is not set in stone. Do not be afraid to deviate from this list completely. Give justifications for your choices.

msilvprog7 commented 8 years ago

We should probably separate the web-service from the site structure.

For the site, I agree with your pages:

Route Functionality
/ index page
/lobbies/ view public and private lobbies visible to user
/lobbies/:lobbyId/ view lobby if accessible, else display or route to error

For the web-service, we should have a separate route path to perform actions:

Route Request Types Functionality
/api/lobbies/ GET POST Retrieve public lobbies (GET) or public and private (POST)
/api/lobby/ POST Create a new lobby (POST) with parameters
/api/lobby/:lobbyId/ GET POST PUT Retrieve a public lobby (GET) - errors for private, retrieve a private lobby with credentials (POST), edit lobby specs (PUT)

What are your thoughts on this?

KyleBibler commented 8 years ago

I had not thought about the web-service at all, but yeah if we could have a similar structure, while being separated, I think that would be a good idea. I think the basic site routes laid out so far make a lot of sense, since everything maps kind of the way you expect it to.

Although I think the web-service should have nearly the exact same mapping as the regular site with just /api in front, so it isn't that different. Something like

Route Request Types Functionality
/lobbies/ GET POST Retrieve public lobbies (GET) or public and private (POST)
/lobbies/create POST Create a new lobby (POST) with parameters
/lobbies/:lobbyId/ GET POST PUT DELETE Retrieve a public lobby (GET) - errors for private, retrieve a private lobby with credentials (POST), edit lobby specs or change host (PUT), delete the lobby only if you are host (DELETE)
/lobbies/:lobbyId/question GET POST Get the question of the lobby (GET), Set the current question of the lobby if you are the host (POST)
/lobbies/:lobbyId/answer GET POST Get all the answers for the lobby (GET), Set the current user's answer (POST)

The GETs for the last 2 are really just there to be there, but all sub functionality requiring POST I think needs to be on it's own route since the lobbies/:lobbyId route already is full on methods.

msilvprog7 commented 8 years ago

Yeah, I like the q/a structure. Should we use an alternative to /lobbies/create to avoid verbs?