app

package
v0.0.0-...-b310a2d Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const UserContextKey contextKey = "user"

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config internal.Config
	Server Server
	DB     internal.Database
}

App for all dependencies of backend server

func NewApp

func NewApp(configFileName string) (*App, error)

NewApp creates a new App instance using the provided Config file.

func (*App) GenerateJwtToken

func (a *App) GenerateJwtToken(payload map[string]interface{}, JWTSecretKey string) (string, error)

func (*App) GetRequestedUser

func (a *App) GetRequestedUser(r *http.Request) (models.User, error)

Get the requested user data.

func (*App) Start

func (a *App) Start()

Start starts the server and listens for incoming requests.

func (*App) VerifyAndDecodeJwtToken

func (a *App) VerifyAndDecodeJwtToken(tokenString, JWTSecretKey string) (models.User, error)

type Handler

type Handler func(w http.ResponseWriter, r *http.Request)

type Response

type Response struct {
	Message string      `json:"message"`
	Status  int         `json:"status"`
	Data    interface{} `json:"data"`
}

type Server

type Server struct {
	Host            string
	Port            int
	ShutdownTimeout int
}

func NewServer

func NewServer(host string, port int) *Server

NewServer creates a new server with host and port attributes.

Jump to

Keyboard shortcuts

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