handlers

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

This code is from https://www.codementor.io/codehakase/building-a-restful-api-with-golang-a6yivzqdo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePerson added in v0.7.0

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

CreatePerson creates a new item

func CreatePersonFromForm added in v0.7.0

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

CreatePersonFromForm creates a new item using form data

func DeletePerson added in v0.7.0

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

DeletePerson deletes an item

func GetDummyRouter added in v0.7.0

func GetDummyRouter() *mux.Router

DummyRouter is router for test

func GetPeople added in v0.7.0

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

GetPeople displays all from the people var

func GetPeopleArray added in v0.8.0

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

func GetPerson added in v0.7.0

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

GetPerson displays a single data

func GetRouter added in v0.7.0

func GetRouter() *mux.Router

Types

type Address added in v0.7.0

type Address struct {
	City  string `json:"city,omitempty"`
	State string `json:"state,omitempty"`
}

Address is the address type

type Person added in v0.7.0

type Person struct {
	ID        string   `json:"id,omitempty"`
	Firstname string   `json:"firstname,omitempty"`
	Lastname  string   `json:"lastname,omitempty"`
	Address   *Address `json:"address,omitempty"`
}

Person is the person type (more like an object)

Jump to

Keyboard shortcuts

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