handlers

package
v0.0.0-...-0529349 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package handlers provides request handlers.

Index

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 PostHome

func PostHome(w http.ResponseWriter, r *http.Request)

PostHome posts home

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

Types

type TestData

type TestData struct {
	Status map[string]string
}

TestData I was testing the "github.com/go-playground/form" library. This helped with parsing array/struct/map like input from html forms

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL