server

package
v0.0.0-...-bd2df9c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorInternalServer = "Sorry, something went wrong. Please try again later."

ErrorInternalServer is the error message to display when something goes wrong on the server

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server represents the server of the application

func New

func New(logger *httplog.Logger, queries *db.Queries, sessionManager *session.Manager) *Server

New returns a new server

func (*Server) Comment

func (s *Server) Comment() http.HandlerFunc

func (*Server) ControversialComments

func (s *Server) ControversialComments() http.HandlerFunc
func (s *Server) ControversialLinks() http.HandlerFunc
func (s *Server) CreateLink() http.HandlerFunc

func (*Server) CreateLinkPage

func (s *Server) CreateLinkPage() http.HandlerFunc

func (*Server) Downvote

func (s *Server) Downvote() http.HandlerFunc

func (*Server) LatestComments

func (s *Server) LatestComments() http.HandlerFunc
func (s *Server) LatestLinks() http.HandlerFunc

func (*Server) Like

func (s *Server) Like() http.HandlerFunc

func (*Server) LinkPage

func (s *Server) LinkPage() http.HandlerFunc

func (*Server) LogIn

func (s *Server) LogIn() http.HandlerFunc

func (*Server) LogInPage

func (s *Server) LogInPage() http.HandlerFunc

func (*Server) LogOut

func (s *Server) LogOut() http.HandlerFunc

func (*Server) PopularComments

func (s *Server) PopularComments() http.HandlerFunc
func (s *Server) PopularLinks() http.HandlerFunc

func (*Server) Redirect

func (s *Server) Redirect(w http.ResponseWriter, r *http.Request, path string)

Redirect is a helper function that makes redirects easier with HX-Request

func (*Server) RedirectIfLoggedIn

func (s *Server) RedirectIfLoggedIn(next http.Handler) http.Handler

func (*Server) RefreshPage

func (s *Server) RefreshPage(w http.ResponseWriter, r *http.Request)

RefreshPage is a helper function that makes refreshing the whole page easier

func (*Server) Reply

func (s *Server) Reply() http.HandlerFunc

func (*Server) ReplyTextbox

func (s *Server) ReplyTextbox() http.HandlerFunc

func (*Server) RequireUser

func (s *Server) RequireUser(next http.Handler) http.Handler

func (*Server) RetargetPage

func (s *Server) RetargetPage(ctx context.Context, w http.ResponseWriter, page templ.Component)

RetargetPage is a helper function that makes retargeting to the whole page easier

func (*Server) Router

func (s *Server) Router() http.Handler

Router returns the http.Handler for the server This is where we define all of our routes

func (*Server) SettingsPage

func (s *Server) SettingsPage() http.HandlerFunc

func (*Server) SignUp

func (s *Server) SignUp() http.HandlerFunc

func (*Server) SignUpPage

func (s *Server) SignUpPage() http.HandlerFunc

func (*Server) Unlike

func (s *Server) Unlike() http.HandlerFunc

func (*Server) Upvote

func (s *Server) Upvote() http.HandlerFunc

func (*Server) UserFromContext

func (s *Server) UserFromContext(ctx context.Context) session.User

func (*Server) UserFromSession

func (s *Server) UserFromSession(next http.Handler) http.Handler

func (*Server) UserPage

func (s *Server) UserPage() http.HandlerFunc

Jump to

Keyboard shortcuts

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