Documentation
¶
Index ¶
- func GenerateToken(user model.User) (string, error)
- func Login(db *sql.DB) http.HandlerFunc
- func ProtectedEndpoint(w http.ResponseWriter, r *http.Request)
- func RespondWithError(w http.ResponseWriter, statusCode int, error model.Error)
- func RespondWithJSON(w http.ResponseWriter, data interface{})
- func Signup(db *sql.DB) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
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
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.