repository

package
v0.0.0-...-cd4cd64 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataResponse

type DataResponse struct {
	StatusCode int
	Data       io.ReadCloser
	Error      string
}

type HttpContext

type HttpContext struct {
	Args map[string]string
	Body io.Reader
}

type JsonResponse

type JsonResponse struct {
	StatusCode int
	Model      interface{}
}

type Muxer

type Muxer interface {
	RegisterJson(path string, handler func(HttpContext) (*JsonResponse, error))
	RegisterData(path string, handler func(HttpContext) (*DataResponse, error))
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(settings *Settings, storage Storage) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context) func() error

type Settings

type Settings struct {
	Port int
}

type Storage

type Storage interface {
	ListFolders(path string) ([]string, error)
	File(path string) (io.Reader, error)
	Exists(path string) bool
	MkDir(path string) error
	CreateFile(path string, file io.Reader) error
	ReadFile(path string) (io.ReadCloser, error)
}

Jump to

Keyboard shortcuts

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