api

package
v0.0.0-...-ba0dc0e Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package api containing API initialization and API route handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Ctx         context.Context
	Collections map[string]*mongo.Collection
	Echo        *echo.Echo
}

API contain context, map of mongodb collection, and echo router

func (*API) AddOrderHandler

func (a *API) AddOrderHandler(c echo.Context) error

AddOrderHandler route handler for add order (Method: POST, User: buyer)

func (*API) DeleteOrderHandler

func (a *API) DeleteOrderHandler(c echo.Context) error

DeleteOrderHandler route handler for delete order (Method: DELETE, User: all)

func (*API) GetOrdersHandler

func (a *API) GetOrdersHandler(c echo.Context) error

GetOrdersHandler route handler for get orders (Method: GET, User: all)

func (*API) InitCollections

func (a *API) InitCollections(DBName string) error

InitCollections initialize API connection to mongodb collections

func (*API) InitRouter

func (a *API) InitRouter()

InitRouter initialize echo router for API

func (*API) UpdateOrderHandler

func (a *API) UpdateOrderHandler(c echo.Context) error

UpdateOrderHandler route handler for update order (Method: PUT, User: all)

Jump to

Keyboard shortcuts

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