Documentation ¶
Overview ¶
Package api gives you a default pattern for registering an API, like a REST API, to be served by the app.
Each file that serves an endpoint of the API should call RegisterPattern or RegisterAppPattern from an init() function in that file. You then simply include that file's package in an import from your app, and everything will get tied together.
This is a pretty simple handler. Likely you will want to add your own middleware on top of the handlers, and you can easily do that by copying this file to your own app and have your api files register with that copy. You can then add handlers how you want.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAppPattern ¶ added in v0.18.0
func RegisterAppPattern(pattern string, handler http.HandlerFunc)
RegisterAppPattern associates the given URL path with the given handler. The handler will be behind the App handler and so will benefit from Session management and the rest of the handlers.
func RegisterPattern ¶
func RegisterPattern(pattern string, handler http.HandlerFunc)
RegisterPattern associates the given URL path with the given handler. The pattern will be behind the ApiPrefix path. The handler will be processed before the regular app management, and so will not get access to session management. Use this if you are using an authorization scheme like oAuth.
Types ¶
This section is empty.