Documentation ¶
Overview ¶
Package echopop adds middleware functions to projects using the Invopop API and the Echo v4 web framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthEnrollment ¶
AuthEnrollment defines a middleware function that will authenticate an enrollment with the Invopop API. This middleware will only work if the invopop client has been prepared using the OAuth Client ID and Secret.
This method supports tokens provided either via the "Authorization" header, or a "state" query parameter, and is meant to be used by applications that offer a web interface via the Invopop Console.
Enrollments authorized in this way will include a new token with additional scopes that can be used to access restricted functionality like updating the embedded enrollment data or accessing silo entry meta rows.
func GetClient ¶
GetClient provides the Invopop client that was prepared with the enrollment's auth token.
func GetEnrollment ¶
func GetEnrollment(c echo.Context) *invopop.Enrollment
GetEnrollment retrieves the enrollment object from the context.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides a wrapper around Echo that makes it a bit easier to start up a new service that will provide an HTTP server.
func NewService ¶
func NewService() *Service
NewService instantiates a new echo service using some reasonable defaults.
func (*Service) Render ¶
Render will prepare the echo templating feature using "goview" and the recommended defaults for modules.
If the source file path is not found, it'll attempt to use the provided filesystem object. Assets served from disk will have caching disabled to facilitate rapid reloading.
Usage example:
m.Render("templates", "./assets", assets.Content)
Where the name ("templates") defines the path inside the source assets folder ("./assets") to find the data, *or* if not available, use the `assets.Content` embedded filesystem.
func (*Service) Root ¶
func (s *Service) Root(fn func(*echo.Group))
Root provides an Echo Group instance from which to serve HTTP requests.
func (*Service) Serve ¶
func (s *Service) Serve(fn func(*echo.Echo))
Serve provides the echo instance in a callback method which might be semantically useful, but doesn't do much.
func (*Service) StaticRootFS ¶
StaticRootFS is used to serve static file assets from the web folder root. The root is the path to the folder in the filesystem, and the fs is the filesystem object to use.