rest

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(baseURL string) *restClient

func NewClientContext

func NewClientContext(baseURL string, ctx context.Context, timeout time.Duration) *restClient

func NewCustomClientContext

func NewCustomClientContext(client *http.Client, baseURL string, ctx context.Context, timeout time.Duration) *restClient

func NewServer

func NewServer(backed storages.Storage) http.Handler

Creates new http handler and provides REST-like access to storage.

GET / - array of all keys. Each key - base64 encoded. New line - new key. Stream is chunk encoded. Returns 200

GET /:key - content of key. Returns 404 if key not found. key should be base64 encoded

POST,PUT,PATCH /:key - update or insert value for key. Returns 204 on success. key should be base64 encoded

DELETE /:key - remove key. Returns 204 on success. key should be base64 encoded

Types

This section is empty.

Jump to

Keyboard shortcuts

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