Documentation ¶
Index ¶
- type App
- func (app *App) GET(path string, handler func(*Request, *ResponseWriter))
- func (app *App) HandleError(statusCode int, r *Request, w *ResponseWriter)
- func (app *App) HandleRoute(r *Request, w *ResponseWriter)
- func (app *App) POST(path string, handler func(*Request, *ResponseWriter))
- func (app *App) Page(path string, handler func(*Request) (int, string))
- func (app *App) SetErrorHandler(statusCode int, handler func(*Request, *ResponseWriter))
- func (app *App) Use(handler func(*Request, *ResponseWriter) bool)
- type Backend
- type NetHTTPBackend
- type Request
- type ResponseWriter
- func (w *ResponseWriter) Data(statusCode int, contentType string, data []byte)
- func (w *ResponseWriter) HTML(statusCode int, data string)
- func (w *ResponseWriter) JSON(statusCode int, data map[string]interface{})
- func (w *ResponseWriter) SetHeader(key string, value string)
- func (w *ResponseWriter) Status(statusCode int)
- func (w *ResponseWriter) String(statusCode int, contentType string, data string)
- func (w *ResponseWriter) Text(statusCode int, data string)
- func (w *ResponseWriter) Write(p []byte) (n int, err error)
- func (w *ResponseWriter) WriteString(p string) (n int, err error)
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Name string // contains filtered or unexported fields }
func (*App) HandleError ¶
func (app *App) HandleError(statusCode int, r *Request, w *ResponseWriter)
func (*App) HandleRoute ¶
func (app *App) HandleRoute(r *Request, w *ResponseWriter)
func (*App) SetErrorHandler ¶
func (app *App) SetErrorHandler(statusCode int, handler func(*Request, *ResponseWriter))
Sets the error handler for a given status code and method type.
type NetHTTPBackend ¶
type NetHTTPBackend struct{}
type Request ¶
type ResponseWriter ¶
type ResponseWriter struct { RawResponseWriter any // Only use this when you need to. Headers map[string]string // contains filtered or unexported fields }
func (*ResponseWriter) Data ¶
func (w *ResponseWriter) Data(statusCode int, contentType string, data []byte)
func (*ResponseWriter) HTML ¶
func (w *ResponseWriter) HTML(statusCode int, data string)
func (*ResponseWriter) JSON ¶
func (w *ResponseWriter) JSON(statusCode int, data map[string]interface{})
func (*ResponseWriter) SetHeader ¶
func (w *ResponseWriter) SetHeader(key string, value string)
func (*ResponseWriter) Status ¶
func (w *ResponseWriter) Status(statusCode int)
func (*ResponseWriter) String ¶
func (w *ResponseWriter) String(statusCode int, contentType string, data string)
func (*ResponseWriter) Text ¶
func (w *ResponseWriter) Text(statusCode int, data string)
func (*ResponseWriter) WriteString ¶
func (w *ResponseWriter) WriteString(p string) (n int, err error)
type RouteHandler ¶
type RouteHandler struct { Method string Run func(*Request, *ResponseWriter) }
Click to show internal directories.
Click to hide internal directories.