Documentation ¶
Index ¶
- Variables
- func Create(t Context) http.HandlerFunc
- func Delete(t Context) http.HandlerFunc
- func ErrInternal(err error) render.Renderer
- func ErrInvalidRequest(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func ErrUnauthorized(err error) render.Renderer
- func List(t Context) http.HandlerFunc
- func Router(ctx context.Context, cfg Config) chi.Router
- func UpdateStatus(t Context) http.HandlerFunc
- func UpdateText(t Context) http.HandlerFunc
- type APIRoute
- type AccountForm
- type Config
- type Context
- type ErrResponse
- type Feature
- type FeatureGroup
- type LoginForm
- type Plan
- type ResetForm
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}
Functions ¶
func Create ¶
func Create(t Context) http.HandlerFunc
func Delete ¶
func Delete(t Context) http.HandlerFunc
func ErrInternal ¶
func ErrInvalidRequest ¶
func ErrUnauthorized ¶
func List ¶
func List(t Context) http.HandlerFunc
func UpdateStatus ¶
func UpdateStatus(t Context) http.HandlerFunc
func UpdateText ¶
func UpdateText(t Context) http.HandlerFunc
Types ¶
type AccountForm ¶
type Config ¶
type Config struct { Name string `json:"name" default:"gomodest"` Domain string `json:"domain" default:"https://gomodest.xyz"` Port int `json:"port" default:"4000"` HealthPath string `json:"health_path" envconfig:"health_path" default:"/healthz"` ReadTimeoutSecs int `json:"read_timeout_secs" envconfig:"read_timeout_secs" default:"5"` WriteTimeoutSecs int `json:"write_timeout_secs" envconfig:"write_timeout_secs" default:"10"` LogLevel string `json:"log_level" envconfig:"log_level" default:"error"` LogFormatJSON bool `json:"log_format_json" envconfig:"log_format_json" default:"false"` Templates string `json:"templates" envconfig:"templates" default:"templates"` SessionSecret string `json:"session_secret" envconfig:"session_secret" default:"mysessionsecret"` APIMasterSecret string `json:"api_master_secret" envconfig:"api_master_secret" default:"supersecretkeyyoushouldnotcommit"` // datasource Driver string `json:"driver" envconfig:"driver" default:"sqlite3"` DataSource string `json:"datasource" envconfig:"datasource" default:"file:gomodest.db?mode=memory&cache=shared&_fk=1"` // smtp SMTPHost string `json:"smtp_host" envconfig:"smtp_host" default:"0.0.0.0"` SMTPPort int `json:"smtp_port,omitempty" envconfig:"smtp_port" default:"1025"` SMTPUser string `json:"smtp_user" envconfig:"smtp_user" default:"myuser" ` SMTPPass string `json:"smtp_pass,omitempty" envconfig:"smtp_pass" default:"mypass"` SMTPAdminEmail string `json:"smtp_admin_email" envconfig:"smtp_admin_email" default:"noreply@gomodest.xyz"` SMTPDebug bool `json:"smtp_debug" envconfig:"smtp_debug" default:"true"` // goth GoogleClientID string `json:"google_client_id" envconfig:"google_client_id"` GoogleSecret string `json:"google_secret" envconfig:"google_secret"` // subscription FeatureGroupsFile string `json:"feature_groups_file" envconfig:"feature_groups_file" default:"feature_groups.development.json"` FeatureGroups []FeatureGroup `json:"-" envconfig:"-"` PlansFile string `json:"plans_file" envconfig:"plans_file" default:"plans.development.json"` Plans []Plan `json:"-" envconfig:"-"` StripePublishableKey string `json:"stripe_publishable_key" envconfig:"stripe_publishable_key"` StripeSecretKey string `json:"stripe_secret_key" envconfig:"stripe_secret_key"` StripeWebhookSecret string `json:"stripe_webhook_secret" envconfig:"stripe_webhook_secret"` }
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code StatusText string `json:"status"` // user-level status message AppCode int64 `json:"code,omitempty"` // application-specific error code ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrResponse renderer type for handling all sorts of errors.
In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
type FeatureGroup ¶
type LoginForm ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.