Categorygithub.com/ecnepsnai/web
modulepackage
1.14.0
Repository: https://github.com/ecnepsnai/web.git
Documentation: pkg.go.dev

# README

Web

Go Report Card Godoc Releases LICENSE

The web project provides two packages, web and router.

Web

Package web is a HTTP server for Golang applications.

It is suitable for both front-end and back-end use, being able to deliver static content, act as a REST-ful JSON server, and as a WebSocket server.

It includes simple controls to allow for user authentication with contextual data being available in every request, and provides simple per-user rate-limiting.

Router

Package router provides a simple & efficient parametrized HTTP router.

A HTTP router allows you to map a HTTP request method and path to a specific function. A parameterized HTTP router allows you to designate specific portions of the request path as a parameter, which can later be fetched during the request itself.

This package allows you modify the routing table ad-hoc, even while the server is running.

Documentation & Examples

For full documentation including examples please see the official package documentation

# Packages

Package router provides a simple & efficient parametrized HTTP router.

# Functions

MockRequest will generate a mock request for testing your handlers.
New create a new server object that will bind to the provided address.
NewListener creates a new server object that will use the given listener.
RealRemoteAddr will try to get the real IP address of the incoming connection taking proxies into consideration.
ValidationError convenience method to make a error object for validation errors.

# Variables

CommonErrors are common errors types suitable for API endpoints.

# Structs

API describes a JSON API server.
APIResponse describes additional response properties for API handles.
Error describes an API error object.
HandleOptions describes options for a route.
HTTP describes a HTTP server.
HTTPEasy describes a simple to use HTTP router.
HTTPResponse describes a HTTP response.
JSONResponse describes an API response object.
Parameters for creating a mock request for uses in tests.
Request describes an API request.
Server describes an web server.
No description provided by the author
WSConn describes a websocket connection.

# Interfaces

Decoder describes a generic interface that has a Decode function.

# Type aliases

APIHandle describes a method signature for handling an API request.
HTTPEasyHandle describes a method signature for handling an HTTP request.
HTTPHandle describes a method signature for handling an HTTP request.
SocketHandle describes a method signature for handling a HTTP websocket request.