Documentation
¶
Index ¶
- type App
- func (app *App) ClientError(w http.ResponseWriter, status int)
- func (app *App) DefaultHandler(w http.ResponseWriter, r *http.Request)
- func (app *App) Forbidden(w http.ResponseWriter)
- func (app *App) GetCode(w http.ResponseWriter, r *http.Request)
- func (app *App) GetStats(w http.ResponseWriter, r *http.Request)
- func (app *App) GetURL(w http.ResponseWriter, r *http.Request)
- func (app *App) Index(w http.ResponseWriter, r *http.Request)
- func (app *App) NotFound(w http.ResponseWriter)
- func (app *App) RenderHTML(w http.ResponseWriter, r *http.Request, page string, data *HTMLData)
- func (app *App) Routes() *mux.Router
- func (app *App) ServerError(w http.ResponseWriter, err error)
- type HTMLData
- type Statistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { HTMLDir string StaticDir string Conn *grpc.ClientConn }
App struct
func (*App) ClientError ¶
func (app *App) ClientError(w http.ResponseWriter, status int)
ClientError helper sends a specific status code and corresponding description to the user.
func (*App) DefaultHandler ¶
func (app *App) DefaultHandler(w http.ResponseWriter, r *http.Request)
DefaultHandler handles any requests not matched by a previous path
func (*App) Forbidden ¶
func (app *App) Forbidden(w http.ResponseWriter)
Forbidden writes a 403 forbidden to the passed responsewriter
func (*App) GetStats ¶
func (app *App) GetStats(w http.ResponseWriter, r *http.Request)
GetStats ...
func (*App) NotFound ¶
func (app *App) NotFound(w http.ResponseWriter)
NotFound helper. This is simply a convenience wrapper around ClientError which sends a 404 Not Found response to the user.
func (*App) RenderHTML ¶
RenderHTML handles data
func (*App) ServerError ¶
func (app *App) ServerError(w http.ResponseWriter, err error)
ServerError helper writes an error message and stack trace to the log, then sends a generic 500 Internal Server Error response to the user.
type HTMLData ¶
type HTMLData struct { Data string Error string Stats Statistics }
HTMLData struct for passing data to html templates
Click to show internal directories.
Click to hide internal directories.