Versions in this module Expand all Collapse all v0 v0.5.8 Apr 10, 2024 v0.5.7 Mar 16, 2024 v0.5.6 Dec 3, 2023 v0.5.5 Dec 3, 2023 v0.5.4 Dec 3, 2023 v0.5.3 Dec 3, 2023 v0.5.2 Dec 3, 2023 v0.5.1 Dec 3, 2023 v0.5.0 Dec 3, 2023 Changes in this version + func APIJSON(ctx context.Context, code int, r APIResponse[any]) (int, []byte, error) v0.4.1 Dec 3, 2023 Changes in this version + func APICommitTx(ctx context.Context) (code int, body []byte, err error) + func APIErrorResponse(ctx context.Context, code int, message string) (int, []byte, error) + func APIJSONBody[ReqData jt.Defaulter[ReqData]](r *http.Request) (reqData ReqData, ctx context.Context, code int, body []byte, err error) + func APIJSONOK(ctx context.Context, r APIResponse[any]) (int, []byte, error) + type APIError struct + Code int + Message string + type APIMetadata struct + RequestUUID uuid.UUID + type APIResponse struct + Data Data + Metadata APIMetadata + func NewAPIError(ctx context.Context, code int, message string) APIResponse[APIError] v0.4.0 Nov 4, 2023 Changes in this version + func Attach(args AttachArgs[A], a A, mux *http.ServeMux) error + func ExecuteTemplate(args TemplateArgs, tmplr templater.Templater) error + func Serve(args ServeArgs, handler http.Handler) + type API interface + ApplyMiddleware func(h http.Handler) http.Handler + Authorize func(w http.ResponseWriter, r *http.Request) (authorized bool, modified *http.Request) + ContentType func() (request, response string) + HTTPMethod func() string + Initialize func(A) error + Respond func(r *http.Request) (code int, body []byte, err error) + URLPattern func() string + type AppSpecific interface + ErrorTemplate func(meta TemplateRespMeta, r *http.Request, w http.ResponseWriter) + Logger func() *slog.Logger + NotFound func(w http.ResponseWriter, r *http.Request) + type AttachArgs struct + API []API[A] + Files http.FileSystem + General []General[A] + MiddlewareOpts middleware.GlobalOptions + Template []Template[A] + Templater templater.Templater + type DevDecider interface + DevMode func() bool + type General interface + ApplyMiddleware func(h http.Handler) http.Handler + Initialize func(A) error + ServeHTTP func(w http.ResponseWriter, r *http.Request) + URLPattern func() string + type RequestData struct + Query map[string]string + type ServeArgs struct + Logger *slog.Logger + Port uint16 + ShutdownFunc func(ctx context.Context) error + ShutdownTimeout time.Duration + type SetupArgs struct + Static embed.FS + Templates embed.FS + type SetupResults struct + Conf C + Files http.FileSystem + Logger *slog.Logger + Templater templater.Templater + func Setup(args SetupArgs) (SetupResults[C], error) + type Template interface + ApplyMiddleware func(h http.Handler) http.Handler + Authorize func(w http.ResponseWriter, r *http.Request) (authorized bool, modified *http.Request, skipTemplate bool) + Initialize func(A) error + Respond func(r *http.Request) (meta TemplateRespMeta, templateData any, wrapperData WrapperData) + TemplateName func() string + URLPattern func() string + WrapperTemplateName func() string + type TemplateArgs struct + Data any + Name string + Request *http.Request + ResponseCode int + WrapperData WrapperData + WrapperName string + Writer http.ResponseWriter + type TemplateDataResult struct + HeaderAdd template.HTML + InnerHTML template.HTML + RequestUUID uuid.UUID + TemplateArgs TemplateArgs + type TemplateRespMeta struct + Cookies []*http.Cookie + RedirectURL string + ResponseCode int + type WrapperData interface + SetResult func(result TemplateDataResult)