api

package
v0.0.0-...-e520e56 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	App    *app.App
	Config *Config
}

func New

func New(a *app.App) (api *API, err error)

func (*API) CreateTodo

func (a *API) CreateTodo(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

func (*API) CreateUser

func (a *API) CreateUser(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

func (*API) DeleteTodoById

func (a *API) DeleteTodoById(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

func (*API) GetTodoById

func (a *API) GetTodoById(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

func (*API) GetTodos

func (a *API) GetTodos(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

func (*API) IPAddressForRequest

func (a *API) IPAddressForRequest(r *http.Request) string

func (*API) Init

func (a *API) Init(r *mux.Router)

func (*API) UpdateTodoById

func (a *API) UpdateTodoById(ctx *app.Context, w http.ResponseWriter, r *http.Request) error

type Config

type Config struct {
	// The port to bind the web application server to
	Port int

	// The number of proxies positioned in front of the API. This is used to interpret
	// X-Forwarded-For headers.
	ProxyCount int
}

func InitConfig

func InitConfig() (*Config, error)

type CreateTodoInput

type CreateTodoInput struct {
	Name string `json:"name"`
	Done bool   `json:"done"`
}

type CreateTodoResponse

type CreateTodoResponse struct {
	Id uint `json:"id"`
}

type UpdateTodoInput

type UpdateTodoInput struct {
	Name *string `json:"name"`
	Done *bool   `json:"done"`
}

type UserInput

type UserInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UserResponse

type UserResponse struct {
	Id uint `json:"id"`
}

Jump to

Keyboard shortcuts

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