handler

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(next http.Handler) http.Handler

func ChangeSessionRole

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

func CreateTestAdminUser added in v0.1.5

func CreateTestAdminUser(id, email, password string) *ent.AdminUser

CreateTestAdminUser creates a test AdminUser entity

func CreateTestAdminUserWithDefaultRole added in v0.1.5

func CreateTestAdminUserWithDefaultRole(user *ent.AdminUser, role *ent.Role) *ent.AdminUser

CreateTestAdminUserWithDefaultRole creates a test AdminUser with DefaultRole in Edges

func CreateTestRole added in v0.1.5

func CreateTestRole(id, name string) *ent.Role

CreateTestRole creates a test Role entity

func HandlerWithHeaders

func HandlerWithHeaders(
	title, endpoint string,
	fetcherHeaders, uiHeaders map[string]string,
) http.HandlerFunc

HandlerWithHeaders sets up the playground. fetcherHeaders are used by the playground's fetcher instance and will not be visible in the UI. uiHeaders are default headers that will show up in the UI headers editor.

func Login

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

TODO: 1. sanitize error messages; 2. move to api; 3. add logs;

func Playground

func Playground(title, endpoint string) http.HandlerFunc

Handler responsible for setting up the playground

func ServeAdmin added in v0.1.6

func ServeAdmin() http.Handler

func ServeFS added in v0.1.6

func ServeFS(fsys fs.FS) http.Handler

ServeFS serves files from a provided fs.FS under the given urlPrefix. Behavior: serves files, serves directory/index.html if present, falls back to root index.html for SPA routes.

func Signup

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

TODO: 1. sanitize error messages; 2. move to api; 3. add logs;

Types

type ChangeSessionRoleRequest

type ChangeSessionRoleRequest struct {
	Role string
}

type LoginFormData

type LoginFormData struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type SignupFormData

type SignupFormData struct {
	Email     string `json:"email"`
	Password  string `json:"password"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

type User

type User interface {
	DefaultRole(ctx context.Context) (*ent.Role, error)
}

Jump to

Keyboard shortcuts

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