server

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 16 Imported by: 6

README

Obvious Service Framework

Contributor Covenant License GitHub release

A simple library for quickly developing web services. Supports HTTP, HTTPS, AWS Gateway Lambda, and AWS Lambda.

The goal is simple, enable a development of Service APIs - not the scaffolding.

How to Use

go get github.com/go-obvious/server
Example Usage

Check out the github.com/go-obvious/server-example for an example...

Documentation

Index

Constants

View Source
const (
	AwsGatewayLambda   = "aws-gateway-v1"
	AwsGatewayV2Lambda = "aws-gateway-v2"
	Https              = "https"
	Http               = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Name() string
	Register(app Server) error
}

type ListenAndServeFunc added in v0.1.9

type ListenAndServeFunc func(addr string, router http.Handler) error

func AWSGatewayLambdaListener added in v0.1.9

func AWSGatewayLambdaListener() ListenAndServeFunc

func AWSGatewayV2LambdaListener added in v0.1.9

func AWSGatewayV2LambdaListener() ListenAndServeFunc

func HTTPListener added in v0.1.9

func HTTPListener() ListenAndServeFunc

func TLSListener added in v0.1.9

func TLSListener(tlsProvider func() *tls.Config) ListenAndServeFunc

type Middleware added in v0.1.7

type Middleware func(next http.Handler) http.Handler

Middleware abstraction

type Server

type Server interface {
	Router() interface{}
	WithListener(l ListenAndServeFunc) Server
	Run(ctx context.Context)
}

func New

func New(
	version *ServerVersion,
	middleware []Middleware,
	apis ...API,
) Server

type ServerVersion

type ServerVersion = about.ServerVersion

Expose the Version struct

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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