Skip to content

Commit

Permalink
Add docs from gofiber/fiber@9178bf7
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 8, 2024
1 parent 8eb8d2c commit b3f5e16
Show file tree
Hide file tree
Showing 41 changed files with 586 additions and 422 deletions.
16 changes: 8 additions & 8 deletions docs/core/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func main() {
micro := fiber.New()
app.Mount("/john", micro) // GET /john/doe -> 200 OK
micro.Get("/doe", func(c *fiber.Ctx) error {
micro.Get("/doe", func(c fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK)
})
Expand Down Expand Up @@ -205,7 +205,7 @@ func main() {
app.Route("/test", func(api fiber.Router) {
api.Get("/foo", handler).Name("foo") // /test/foo (name: test.foo)
api.Get("/bar", handler).Name("bar") // /test/bar (name: test.bar)
api.Get("/bar", handler).Name("bar") // /test/bar (name: test.bar)
}, "test.")
log.Fatal(app.Listen(":3000"))
Expand Down Expand Up @@ -261,7 +261,7 @@ func (app *App) Stack() [][]*Route
```
```go title="Examples"
var handler = func(c *fiber.Ctx) error { return nil }
var handler = func(c fiber.Ctx) error { return nil }
func main() {
app := fiber.New()
Expand Down Expand Up @@ -315,7 +315,7 @@ func (app *App) Name(name string) Router
```
```go title="Examples"
var handler = func(c *fiber.Ctx) error { return nil }
var handler = func(c fiber.Ctx) error { return nil }
func main() {
app := fiber.New()
Expand Down Expand Up @@ -417,7 +417,7 @@ func (app *App) GetRoute(name string) Route
```
```go title="Examples"
var handler = func(c *fiber.Ctx) error { return nil }
var handler = func(c fiber.Ctx) error { return nil }
func main() {
app := fiber.New()
Expand Down Expand Up @@ -454,7 +454,7 @@ When filterUseOption equal to true, it will filter the routes registered by the
```go title="Examples"
func main() {
app := fiber.New()
app.Post("/", func (c *fiber.Ctx) error {
app.Post("/", func (c fiber.Ctx) error {
return c.SendString("Hello, World!")
}).Name("index")
data, _ := json.MarshalIndent(app.GetRoutes(true), "", " ")
Expand Down Expand Up @@ -627,7 +627,7 @@ func (app *App) Test(req *http.Request, msTimeout ...int) (*http.Response, error
```go title="Examples"
// Create route with GET method for test:
app.Get("/", func(c *fiber.Ctx) error {
app.Get("/", func(c fiber.Ctx) error {
fmt.Println(c.BaseURL()) // => http://google.com
fmt.Println(c.Get("X-Custom-Header")) // => hi
Expand All @@ -654,4 +654,4 @@ Hooks is a method to return [hooks](../guide/hooks.md) property.

```go title="Signature"
func (app *App) Hooks() *Hooks
```
```
8 changes: 4 additions & 4 deletions docs/core/api/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (c *Client) Delete(url string) *Agent
Here we present a brief example demonstrating the simulation of a proxy using our `*fiber.Agent` methods.
```go
// Get something
func getSomething(c *fiber.Ctx) (err error) {
func getSomething(c fiber.Ctx) (err error) {
agent := fiber.Get("<URL>")
statusCode, body, errs := agent.Bytes()
if len(errs) > 0 {
Expand All @@ -43,7 +43,7 @@ func getSomething(c *fiber.Ctx) (err error) {
}

// Post something
func createSomething(c *fiber.Ctx) (err error) {
func createSomething(c fiber.Ctx) (err error) {
agent := fiber.Post("<URL>")
agent.Body(c.Body()) // set body received by request
statusCode, body, errs := agent.Bytes()
Expand Down Expand Up @@ -268,10 +268,10 @@ agent.BodyStream(strings.NewReader("body=stream"), -1)

### JSON

JSON sends a JSON request by setting the Content-Type header to the `ctype` parameter. If no `ctype` is passed in, the header is set to `application/json`.
JSON sends a JSON request by setting the Content-Type header to `application/json`.

```go title="Signature"
func (a *Agent) JSON(v interface{}, ctype ...string) *Agent
func (a *Agent) JSON(v interface{}) *Agent
```

```go title="Example"
Expand Down
Loading

0 comments on commit b3f5e16

Please sign in to comment.