restsrv

package
v0.0.0-...-902e17f Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartServer

func StartServer(cfg *Config, bc *bcstore.ChainStorage)

Types

type Config

type Config struct {
	HTTPConn string
}

func NewConfig

func NewConfig() *Config

type Context

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

func (*Context) Exec

func (c *Context) Exec()

func (*Context) WriteError

func (c *Context) WriteError(err error, httpCode int)

----------------------- response -------------------------------------

func (*Context) WriteVar

func (c *Context) WriteVar(v interface{}, ee ...error)

type Response

type Response struct {
	Results    interface{} `json:"results,omitempty"`
	NextOffset string      `json:"next_offset,omitempty"`
	Error      string      `json:"error,omitempty"`
}

func NewResponse

func NewResponse(res interface{}, nextOffset interface{}, err error) *Response

type Server

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

func NewService

func NewService(cfg *Config, bc *bcstore.ChainStorage) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Server) Start

func (s *Server) Start()

Jump to

Keyboard shortcuts

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