restapi

package
v0.0.0-...-cfba5c7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package restapi contains the REST API implementation for the LoRa Core server.

The most relevant endpoints are as follows (GET and POST methods are supported):

/applications
/applications/{EUI}/devices
/applications/{EUI}/devices/{EUI}
/gateways

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromUnixMillis

func FromUnixMillis(unixMillis int64) int64

FromUnixMillis converts a millisecond timestamp into nanosecond timestamp. Note that this assumes that time.Nanosecond = 1 (which it is)

func ToUnixMillis

func ToUnixMillis(unixNanos int64) int64

ToUnixMillis converts a nanosecond timestamp into a millisecond timestamp. the general assumption is that time.Nanosecond = 1 (which it is)

Types

type Server

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

Server is a type capable of serving the REST API for Congress. It can be started and dhut down only once reliably since the port lingers. There is no check if the server is running so calling Start() twice will result in errors

func NewServer

func NewServer(loopbackOnly bool, scontext *server.Context, config *server.Configuration) (*Server, error)

NewServer returns a new server instance. if the port is set to 0 it will pick a random port. If loopbackOnly is true only the loopback adapter will be used.

func (*Server) ServeHTTP

func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown

func (h *Server) Shutdown() error

Shutdown stops the server. There's no check if the server is already running. Run Shutdown() twice at your own risk.

func (*Server) Start

func (h *Server) Start() error

Start launches the server. The server won't check if it has been started twice

Jump to

Keyboard shortcuts

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