@@ -232,27 +232,37 @@ Routes an HTTP request, where **METHOD** is the [HTTP method](https://developer.
232
232
** Signature**
233
233
234
234
``` go
235
- // All, Get, Put, Post, Head, Patch
236
- // Trace, Delete, Connect, Options
237
- app.Get (path string , handlers ...func (*Ctx))
238
-
239
- // Matches any HTTP method
240
- // Matches path starting with prefix
235
+ /* These methods support :param & :optional? in path
236
+ You are required to pass a path to each method */
237
+ app.All (path string , handlers ...func (*Ctx))
238
+ app.Get (...
239
+ app.Put (...
240
+ app.Post (...
241
+ app.Head (...
242
+ app.Patch (...
243
+ app.Trace (...
244
+ app.Delete (...
245
+ app.Connect (...
246
+ app.Options (...
247
+
248
+ /* Use will only match the prefix of each path
249
+ i.e. "/john" will match "/john/doe", "/johnnnn"
250
+ Use does not support :param & :optional? in path */
241
251
app.Use (handlers ...func (*Ctx))
242
252
app.Use (prefix string , handlers ...func (*Ctx))
243
253
```
244
254
245
255
** Example**
246
256
247
257
``` go
248
- app.Use (func (c *fiber.Ctx ) {
249
- c.Send (c. Method ( ))
258
+ app.Use (" /api " , func (c *fiber.Ctx ) {
259
+ c.Set ( " X-Custom-Header " , random. String ( 32 ))
250
260
c.Next ()
251
261
})
252
- app.Get (" /" , func (c *fiber.Ctx ) {
262
+ app.Get (" /api/list " , func (c *fiber.Ctx ) {
253
263
c.Send (" I'm a GET request!" )
254
264
})
255
- app.Post (" /" , func (c *fiber.Ctx ) {
265
+ app.Post (" /api/register " , func (c *fiber.Ctx ) {
256
266
c.Send (" I'm a POST request!" )
257
267
})
258
268
```
0 commit comments