Documentation
¶
Overview ¶
Package handlers provides request handlers.
Index ¶
- func DeleteUsersID(w http.ResponseWriter, r *http.Request)
- func GetAbout(w http.ResponseWriter, r *http.Request)
- func GetCurator(w http.ResponseWriter, r *http.Request)
- func GetHistory(w http.ResponseWriter, r *http.Request)
- func GetHome(w http.ResponseWriter, r *http.Request)
- func GetLogin(w http.ResponseWriter, r *http.Request)
- func GetLoginWithoutSession(w http.ResponseWriter, r *http.Request)
- func GetLogout(w http.ResponseWriter, r *http.Request)
- func GetSignup(w http.ResponseWriter, r *http.Request)
- func GetSubmit(w http.ResponseWriter, r *http.Request)
- func GetWords(w http.ResponseWriter, r *http.Request)
- func HandleRoot(w http.ResponseWriter, r *http.Request)
- func PostCurator(w http.ResponseWriter, r *http.Request)
- func PostHistory(w http.ResponseWriter, r *http.Request)
- func PostHome(w http.ResponseWriter, r *http.Request)
- func PostLogin(w http.ResponseWriter, r *http.Request)
- func PostPutDeleteUsersID(w http.ResponseWriter, r *http.Request)
- func PostSignup(w http.ResponseWriter, r *http.Request)
- func PostSubmit(w http.ResponseWriter, r *http.Request)
- func PutUsersID(w http.ResponseWriter, r *http.Request)
- type TestData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteUsersID ¶
func DeleteUsersID(w http.ResponseWriter, r *http.Request)
DeleteUsersID is not implemented
func GetAbout ¶
func GetAbout(w http.ResponseWriter, r *http.Request)
GetAbout generates the about page
func GetCurator ¶
func GetCurator(w http.ResponseWriter, r *http.Request)
GetCurator handles the loading of the curator page. It first checks if the user is a curator. If not it should redirect the user to the main page. A query to the phrases DB is made and it returns the phrases that are in review.
func GetHistory ¶
func GetHistory(w http.ResponseWriter, r *http.Request)
GetHistory generates a page showing the users' history of phrase ratings and phrase submissions
func GetHome ¶
func GetHome(w http.ResponseWriter, r *http.Request)
GetHome generates the home page of the system
func GetLogin ¶
func GetLogin(w http.ResponseWriter, r *http.Request)
GetLogin first checks if a user is already logged in. If the user is already logged in, the user is redirected to the home page. If not GetLoginWithoutSession is called
func GetLoginWithoutSession ¶
func GetLoginWithoutSession(w http.ResponseWriter, r *http.Request)
GetLoginWithoutSession generates the login page without checking if an existing user has already logged in
func GetLogout ¶
func GetLogout(w http.ResponseWriter, r *http.Request)
GetLogout deletes the current user from the session and redirects to the main page
func GetSignup ¶
func GetSignup(w http.ResponseWriter, r *http.Request)
GetSignup generates the user signup page
func GetSubmit ¶
func GetSubmit(w http.ResponseWriter, r *http.Request)
GetSubmit generates a page for logged in users to submit their own phrases.
func GetWords ¶
func GetWords(w http.ResponseWriter, r *http.Request)
GetWords loads the page listing all of the words in our system
func HandleRoot ¶
func HandleRoot(w http.ResponseWriter, r *http.Request)
HandleRoot redirects to now
func PostCurator ¶
func PostCurator(w http.ResponseWriter, r *http.Request)
PostCurator handles POST requests to the system
func PostHistory ¶
func PostHistory(w http.ResponseWriter, r *http.Request)
PostHistory handles the update of user ratings for phrases
func PostLogin ¶
func PostLogin(w http.ResponseWriter, r *http.Request)
PostLogin handles user authentication. If the user has an account in the system, he/she is redirected to the home page If the user used the wrong credentials, redirect them to the login page with an error message.
func PostPutDeleteUsersID ¶
func PostPutDeleteUsersID(w http.ResponseWriter, r *http.Request)
PostPutDeleteUsersID will redirect to either the PutUsersID or the DeleteUsersID handlers depending on the typpe of request
func PostSignup ¶
func PostSignup(w http.ResponseWriter, r *http.Request)
PostSignup reads the new user's credentials and stores them in the user DB if they are valid After signing up, the user is autmatically logged in.
func PostSubmit ¶
func PostSubmit(w http.ResponseWriter, r *http.Request)
PostSubmit handles the submission of a phrase. A phrase will be stored in the phrase DB as a phrase that needs to be reviewed. It then redirects the user to the GetSubmit handler
func PutUsersID ¶
func PutUsersID(w http.ResponseWriter, r *http.Request)
PutUsersID updates the user data