elsa

package module
v0.0.0-...-71a9ee9 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2017 License: MIT Imports: 13 Imported by: 0

README

elsa

GoDoc GoCard

elsa - server application package

This package helps to build RPC servers in go.

Currently only JSON-RPC over HTTP protocol available.

Install

go get github.com/LeKovr/elsa

License

The MIT License (MIT), see LICENSE.

Copyright (c) 2016 Alexey Kovrizhkin ak@elfire.ru

Documentation

Index

Constants

View Source
const Version = "1.1"

Version of elsa package

Variables

This section is empty.

Functions

func APIServer

func APIServer(srv http.Handler, log *logger.Log, host ...string) http.Handler

APIServer extends srv.ServeHTTP with OPTIONS support

func DB

func DB(db *database.DB) func(*Server) error

DB is a database attr setter

Types

type Flags

type Flags struct {
	Addr  string   `long:"http_addr" default:"localhost:8080"  description:"Http listen address"`
	Hosts []string `long:"http_origin" description:"Allowed http origin(s)"`
}

Flags is a package flags sample in form ready for use with github.com/jessevdk/go-flags

type Server

type Server struct {
	Listener net.Listener
	Router   *mux.Router
	RPC      *rpc.Server
	Chain    alice.Chain
	DB       *database.DB
	Log      *logger.Log
}

Server struct handles all server onjects

func New

func New(addr string, log *logger.Log, options ...func(*Server) error) (*Server, error)

New returns initialized Server object

func (*Server) Cleanup

func (s *Server) Cleanup()

Cleanup server objects

func (*Server) Handle

func (s *Server) Handle(uri string, handler http.Handler)

Handle adds chained route handler

func (*Server) RunServer

func (s *Server) RunServer()

RunServer starts server's ListenAndServe

Directories

Path Synopsis
api
mw
ace
ace is a elsa middleware for ace
ace is a elsa middleware for ace
render
render is a elsa middleware for render
render is a elsa middleware for render
rpc
pagedata holds web page attributes
pagedata holds web page attributes
struct
page
page holds web page attributes
page holds web page attributes

Jump to

Keyboard shortcuts

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