server

package
v0.0.0-...-1db7b98 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server provides the application's HTTP server, wired with routes according to the structure of the api package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppName          string
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
	JwtCfg           JWTConfig
	EnableStackTrace bool
	AllowOrigins     string
}

type JWTConfig

type JWTConfig struct {
	RS265PrivateKey *rsa.PrivateKey
	TTL             time.Duration
	Issuer          string
}

func (JWTConfig) PublicKey

func (cfg JWTConfig) PublicKey() *rsa.PublicKey

type Server

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

Server encapsulates a Fiber app and exposes methods for starting and stopping the server.

func New

func New(
	cfg Config,
	userService user.Service,
) *Server

New configures an application server with the injected configuration and dependencies.

func (*Server) Listen

func (s *Server) Listen(addr string) error

Listen on the given address.

func (*Server) ShutdownWithTimeout

func (s *Server) ShutdownWithTimeout(timeout time.Duration) error

ShutdownWithTimeout gracefully shuts down the server, closing open connections at `timeout`.

Jump to

Keyboard shortcuts

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