handlers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

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

CreateUser Use curl: curl -v POST http://localhost:8080/v1/user -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'

func LoginUser

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

LoginUser Use curl: curl -v POST http://localhost:8080/v1/user/login -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'

Types

type CreateUserRequest

type CreateUserRequest struct {
	UserName string `json:"userName" validate:"required,min=4,max=100"`
	Password string `json:"password" validate:"required,min=8,max=100"`
}

CreateUserRequest defines model for CreateUserRequest.

type CreateUserResponse

type CreateUserResponse struct {
	Id       string `json:"id"`
	UserName string `json:"userName"`
}

CreateUserResponse defines model for CreateUserResponse.

type LoginUserRequest

type LoginUserRequest struct {
	// The password for login in clear text
	Password string `json:"password" validate:"required"`

	// The username for login
	UserName string `json:"userName" validate:"required"`
}

LoginUserRequest defines model for LoginUserRequest.

type LoginUserResponse

type LoginUserResponse struct {
	// An url for websocket API with a one-time token for starting chat
	Url string `json:"url"`
}

LoginUserResponse defines model for LoginUserResponse.

Jump to

Keyboard shortcuts

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