You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Middleware provide a convenient mechanism for filtering HTTP requests entering your application. You only need to implement the `Middleware` interface.
}).Middleware(func(request *context.Request, next router.Closure) interface{} {
161
-
if_, err:= request.Input("name"); err != nil {
162
-
return thinkgo.Text("Invalid parameters")
163
-
}
164
-
returnnext(request)
165
-
})
166
-
```
167
-
168
153
#### Route Groups
169
154
170
155
Route groups allow you to share route attributes, such as middleware or prefix, across a large number of routes without needing to define those attributes on each individual route.
Middleware provide a convenient mechanism for filtering HTTP requests entering your application. You only need to implement the `Middleware` interface.
}).Middleware(func(request *context.Request, next router.Closure) interface{} {
193
+
if_, err:= request.Input("name"); err != nil {
194
+
return thinkgo.Text("Invalid parameters")
195
+
}
196
+
returnnext(request)
197
+
})
198
+
```
199
+
200
+
#### Before Middleware
201
+
202
+
Whether a middleware runs before or after a request depends on the middleware itself. For example, the following middleware would perform some task `before` the request is handled by the application:
0 commit comments