Group is a set of sub-routes for a specified route. It can be used for inner routes that share a common middleware or functionality that should be separate from the parent echo instance while still inheriting from it.

Hierarchy

  • Group

Methods

  • File implements Echo#File() for sub-routes within the Group. Panics on error.

    Parameters

    Returns RouteInfo

  • Group creates a new sub-group with prefix and optional sub-group-level middleware. Important! Group middlewares are only executed in case there was exact route match and not for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add a catch-all route /* for the group which handler returns always 404

    Parameters

    Returns echo.Group

  • Match implements Echo#Match() for sub-routes within the Group. Panics on error.

    Parameters

    Returns Routes

  • RouteNotFound implements Echo#RouteNotFound() for sub-routes within the Group.

    Example: g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })

    Parameters

    Returns RouteInfo

  • Static implements Echo#Static() for sub-routes within the Group.

    Parameters

    • pathPrefix: string
    • fsRoot: string

    Returns RouteInfo

  • StaticFS implements Echo#StaticFS() for sub-routes within the Group.

    When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

    Parameters

    • pathPrefix: string
    • filesystem: FS

    Returns RouteInfo

  • Use implements Echo#Use() for sub-routes within the Group. Group middlewares are not executed on request when there is no matching route found.

    Parameters

    Returns void

Generated using TypeDoc