controllers

package
v0.0.0-...-ed7bc7a Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CurrentUser keeps the current user to use on the whole package
	CurrentUser models.User
)

Functions

func Delete

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

Delete deletes the account.

func Login

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

Login creates session and returns a token. Form must contains "username" and "password".

func Logout

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

Logout removes the sessions of the current user.

func Me

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

Me returns current user's info.

func NoiseCreate

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

NoiseCreate create a noise for the current user. Form must contains "title" and "file". Form may contains "tags". Example: "Tag 1, Tag 2"

func NoiseDelete

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

NoiseDelete temporarily deletes the given noise and it's file

func NoiseFileShow

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

NoiseFileShow returns the noise's file. There must be an {id} parameter.

func NoiseIndex

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

NoiseIndex returns all noise for the current user.

func NoiseShow

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

NoiseShow returns the noise. There must be an {id} parameter.

func NoiseUpdate

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

NoiseUpdate update the noise. It works just like creating.

func SignUp

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

SignUp creates users Form must contains "name", "surname", "username" and "password".

func UserAuthMiddleware

func UserAuthMiddleware(next http.Handler) http.Handler

UserAuthMiddleware returns a middleware. That middleware check if the user's token is valid.

func Welcome

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

Welcome just returns a hello message.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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