service

package
v0.0.0-...-011266a Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(user model.User) (string, error)

GenerateToken will generate jwt token based on user login email

func Login

func Login(db *sql.DB) http.HandlerFunc

Login will login user with the email and password user provide

func ProtectedEndpoint

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

func RespondWithError

func RespondWithError(w http.ResponseWriter, statusCode int, error model.Error)

RespondWithError takes the status code and error and write back the error json

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, data interface{})

RespondWithJSON takes the status code and error and write back the error json

func Signup

func Signup(db *sql.DB) http.HandlerFunc

Signup lets user sign up with email and password

Types

This section is empty.

Jump to

Keyboard shortcuts

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