Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions website/docs/guide/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ middleware. In addition to specified middleware group also inherits parent middl
To add middleware later in the group you can use `Group.Use(m ...Middleware)`.
Groups can also be nested.

:::note

Group level middlewares are tied to the route and will work only if the group has at least one route.

:::

### Basic Group Usage

```go
Expand Down
9 changes: 9 additions & 0 deletions website/docs/middleware/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ e.Use(middleware.Static("/static"))
This serves static files from `static` directory. For example, a request to `/js/main.js`
will fetch and serve `static/js/main.js` file.



## Custom Configuration

### Usage
Expand All @@ -38,8 +40,15 @@ Default behavior when using with non root URL paths is to append the URL path to
group := root.Group("somepath")
group.Use(middleware.Static(filepath.Join("filesystempath")))
// When an incoming request comes for `/somepath` the actual filesystem request goes to `filesystempath/somepath` instead of only `filesystempath`.
group.GET("/*", func(c *echo.Context) error { return echo.ErrNotFound })
```

:::note

Group level middlewares are tied to the route and will work only if the group has at least one route.

:::

:::tip

To turn off this behavior set the `IgnoreBase` config param to `true`.
Expand Down
Loading