controllers

package
v0.0.0-...-914140b Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	DB     *gorm.DB
	Router *mux.Router
}

Service global context

func (*Service) CreateUser

func (service *Service) CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser callback funtion curl -i -X POST -H "Content-Type: application/json" -d "{ \"firstname\": \"Jhon\", \"lastname\": \"Donals\", \"email\": \"jd@fake.com\",\"password\": \"1234\"}" http://localhost:8080/user/add

func (*Service) DeleteUser

func (service *Service) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser handler curl -i -X DELETE http://localhost:8080/user/1

func (*Service) GetUserByID

func (service *Service) GetUserByID(w http.ResponseWriter, r *http.Request)

GetUserByID handler curl -i -X GET http://localhost:8080/user/1

func (*Service) Home

func (service *Service) Home(w http.ResponseWriter, r *http.Request)

Home callback funtion

func (*Service) Initialize

func (service *Service) Initialize(DBType, DBUser, DBPassword, DBHost, DBName, APISecret string, DBPort int)

Initialize Server Database

func (*Service) Login

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

Login handler curl -i -X POST -H "Content-Type: application/json" -d "{ \"email\": \"jd@fake.com\",\"password\": \"1234\"}" http://localhost:8080/login

func (*Service) Run

func (service *Service) Run(addr string)

Run http server

func (*Service) SignIn

func (service *Service) SignIn(email, password string) (string, error)

SignIn check that credentials are correct

func (*Service) UpdateUser

func (service *Service) UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser handler curl -i -X POST -H "Content-Type: application/json" -d "{ \"firstname\": \"Jhon\", \"lastname\": \"Donals\", \"email\": \"jd@fakeee.com\",\"password\": \"1234\"}" http://localhost:8080/user/1

Jump to

Keyboard shortcuts

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