Documentation
¶
Overview ¶
Package web Cozy Stack API.
Cozy is a personal platform as a service with a focus on data.
Index ¶
- Variables
- func CreateSubdomainProxy(router *echo.Echo, services *stack.Services, appsHandler echo.HandlerFunc) (*echo.Echo, error)
- func LoadSupportedLocales() error
- func SetupAdminRoutes(router *echo.Echo) error
- func SetupAppsHandler(appsHandler echo.HandlerFunc) echo.HandlerFunc
- func SetupAssets(router *echo.Echo, assetsPath string) (err error)
- func SetupRoutes(router *echo.Echo, services *stack.Services) error
- type Servers
Constants ¶
This section is empty.
Variables ¶
var (
ErrMissingArgument = errors.New("the argument is missing")
)
var ReadHeaderTimeout = 15 * time.Second
ReadHeaderTimeout is the amount of time allowed to read request headers for all servers. This is activated for all handlers from all http servers created by the stack.
Functions ¶
func CreateSubdomainProxy ¶
func CreateSubdomainProxy(router *echo.Echo, services *stack.Services, appsHandler echo.HandlerFunc) (*echo.Echo, error)
CreateSubdomainProxy returns a new web server that will handle that apps proxy routing if the host of the request match an application, and route to the given router otherwise.
func LoadSupportedLocales ¶
func LoadSupportedLocales() error
LoadSupportedLocales reads the po files packed in go or from the assets directory and loads them for translations
func SetupAdminRoutes ¶
func SetupAdminRoutes(router *echo.Echo) error
SetupAdminRoutes sets the routing for the administration HTTP endpoints
func SetupAppsHandler ¶
func SetupAppsHandler(appsHandler echo.HandlerFunc) echo.HandlerFunc
SetupAppsHandler adds all the necessary middlewares for the application handler.
func SetupAssets ¶
SetupAssets add assets routing and handling to the given router. It also adds a Renderer to render templates.
func SetupRoutes ¶
SetupRoutes sets the routing for HTTP endpoints
Types ¶
type Servers ¶
type Servers struct {
// contains filtered or unexported fields
}
Servers allow to start several echo.Echo servers and stop them together.
It also take care of several other task: - It sanitize the hosts format - It exposes the handlers on several addresses if needed - It forces the IPv4/IPv6 dual stack mode for `localhost` by remplacing this entry by `["127.0.0.1", "::1]`
func ListenAndServe ¶
ListenAndServe creates and setups all the necessary http endpoints and start them.
func ListenAndServeWithAppDir ¶
func ListenAndServeWithAppDir(appsdir map[string]string, services *stack.Services) (*Servers, error)
ListenAndServeWithAppDir creates and setup all the necessary http endpoints and serve the specified application on a app subdomain.
In order to serve the application, the specified directory should provide a manifest.webapp file that will be used to parameterize the application permissions.
func NewServers ¶
func NewServers() *Servers
func (*Servers) GetAddr ¶
GetAddr return the address where the given server listen to.
This endpoint is mostly used when we use dynamic port attribution like when we don't specify a port
Directories
¶
Path | Synopsis |
---|---|
Package apps is the HTTP frontend of the application package.
|
Package apps is the HTTP frontend of the application package. |
Package auth provides register and login handlers
|
Package auth provides register and login handlers |
Package bitwarden exposes an API compatible with the Bitwarden Open-Soure apps.
|
Package bitwarden exposes an API compatible with the Bitwarden Open-Soure apps. |
Package conncheck returns HTTP 204 No Content for connectivity check
|
Package conncheck returns HTTP 204 No Content for connectivity check |
Package contacts exposes a route for the myself document.
|
Package contacts exposes a route for the myself document. |
Package data provide simple CRUD operation on couchdb doc
|
Package data provide simple CRUD operation on couchdb doc |
Package files is the HTTP frontend of the vfs package.
|
Package files is the HTTP frontend of the vfs package. |
Package instances is used for the admin endpoint to manage instances.
|
Package instances is used for the admin endpoint to manage instances. |
Package middlewares is used for the HTTP middlewares, ie functions that takes an echo context to do stuff like checking permissions or caching requests.
|
Package middlewares is used for the HTTP middlewares, ie functions that takes an echo context to do stuff like checking permissions or caching requests. |
Package notes is about the documents of cozy-notes.
|
Package notes is about the documents of cozy-notes. |
Package permissions is the HTTP handlers for managing the permissions on a Cozy (creating a share by link for example).
|
Package permissions is the HTTP handlers for managing the permissions on a Cozy (creating a share by link for example). |
Package public adds some public routes that can be used to give information to anonymous users, or to the not yet authentified cozy owner on its login page.
|
Package public adds some public routes that can be used to give information to anonymous users, or to the not yet authentified cozy owner on its login page. |
Package remote is the used for the /remote routes.
|
Package remote is the used for the /remote routes. |
Package settings regroups some API methods to facilitate the usage of the io.cozy settings documents.
|
Package settings regroups some API methods to facilitate the usage of the io.cozy settings documents. |
Package sharings is the HTTP routes for the sharing.
|
Package sharings is the HTTP routes for the sharing. |
Package shortcuts is about the .url shortcuts.
|
Package shortcuts is about the .url shortcuts. |
Package status is here just to say that the API is up and that it can access the CouchDB databases, for debugging and monitoring purposes.
|
Package status is here just to say that the API is up and that it can access the CouchDB databases, for debugging and monitoring purposes. |
Package version gives informations about the version of the cozy-stack
|
Package version gives informations about the version of the cozy-stack |