# README

Server

Server library provides a complete HTTP/HTTPS server that can be easily embedded in your application and requires minimum to no configuration, being able to run securely with its default settings.

Features

  • Automatic routing
  • Auto acquire HTTPS certificates through Let's Encrypt
  • Session management with support for different stores (DB, Redis, In-Memory built in stores)
  • Support for various input/output encodings (JSON, XML, Binary, gRPC built in)
  • Support for various compression algorithms (GZip, Deflate, Brotli built in)
  • Access logs (Apache format compatible)
  • Security enhancements (XSS, CSRF, DNT, HSTS, CSP, BruteForce, Rate Limiter, Whitelist/Blacklist built in)
  • Request tracing
  • Server statistics
  • Internationalization and GeoIP detection support

Install

$ go get github.com/najibulloShapoatov/server-core/server

Usage example(s)

Start a server that listens on HTTP(80)
import (
   "github.com/najibulloShapoatov/server-core/server"
)

func main() {
    svc := server.New(nil)
    svc.Start()
}
Register custom stores and engines
// register 2 new middleware functions
server.UseMiddleware(m1, m2) 

// register decoder/encoder for some custom content type
server.RegisterDecoder("text/yaml", myYAMLDecoder)
server.RegisterEncoder("text/yaml", myYAMLEncoder)

// register http endpoints for all your module handlers
server.RegisterRoute(myService)


# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
RegisterDecoder registers a InputFunc decoder that can handle the given MIME type.
RegisterEncoder registers a OutputFunc decoder that can handle the given MIME type.
Register all services handlers.
Remove service handler.
Remove all service handlers.
Register a handler that will be called before the request handler is called.

# Structs

No description provided by the author
No description provided by the author
config contains all the configurations of the server and is suited with default values that require minimum to no intervention to start a secure web server.
Context provided by the server to handle a request.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

Manager interface is required by the server to be used as certificate provider.

# Type aliases

Handler function used by middleware to chain call all of them.
InputFunc is the signature a decoder must implement to be registered as valid input decoder.
Middleware function signature.
OutputFunc is the signature a encoder must implement to be registered as valid output encoder.