server

package
v0.0.0-...-dbfe939 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateServer

func CreateServer() (*http.Server, error)

func GetHealthCheck

func GetHealthCheck(w http.ResponseWriter, r *http.Request)

func RespondWithError

func RespondWithError(w http.ResponseWriter, statusCode int, msg string)

func RespondWithJson

func RespondWithJson(w http.ResponseWriter, statusCode int, payload interface{})

Types

type AuthHandler

type AuthHandler func(http.ResponseWriter, *http.Request, database.User)

type Config

type Config struct {
	DB  *database.Queries
	Hub *ws.Hub
	Env *Env
}

func CreateConfig

func CreateConfig() (*Config, error)

func (*Config) ConnectToRoom

func (c *Config) ConnectToRoom(w http.ResponseWriter, r *http.Request, user database.User)

func (*Config) CreateRoom

func (c *Config) CreateRoom(w http.ResponseWriter, r *http.Request, user database.User)

func (*Config) CreateUser

func (c *Config) CreateUser(w http.ResponseWriter, r *http.Request)

func (Config) EnsureAuth

func (c Config) EnsureAuth(handler AuthHandler) http.HandlerFunc

func (*Config) GetAllRooms

func (c *Config) GetAllRooms(w http.ResponseWriter, r *http.Request, _ database.User)

func (*Config) GetUser

func (c *Config) GetUser(w http.ResponseWriter, r *http.Request, user database.User)

func (*Config) Login

func (c *Config) Login(w http.ResponseWriter, r *http.Request)

func (*Config) NewRouter

func (c *Config) NewRouter() *http.ServeMux

type Env

type Env struct {
	PORT   string
	DB_URL string
}

func LoadEnv

func LoadEnv() (*Env, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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