Skip to content

Commit

Permalink
chore: format Markdown doc block with mdsf
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoVeille authored and EwenQuim committed Sep 1, 2024
1 parent df1b3c5 commit 4b6b12d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 18 deletions.
2 changes: 0 additions & 2 deletions documentation/docs/guides/middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func main() {
// Requests to / will NOT! go through the middleware
fuego.Get(s, "/", myController)


s.Run()
}
```
Expand All @@ -90,7 +89,6 @@ package main

import (
"github.com/go-fuego/fuego"
"net/http"
)

func main() {
Expand Down
13 changes: 6 additions & 7 deletions documentation/docs/guides/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func main() {
func helloWorld(c fuego.ContextNoBody) (string, error) {
return "Hello, World!", nil
}

```

## Output
Expand All @@ -81,12 +80,12 @@ import (

func main() {
s := fuego.NewServer(fuego.WithOpenAPIConfig(fuego.OpenAPIConfig{
DisableSwagger : false, // If true, the server will not serve the swagger ui nor the openapi json spec
DisableLocalSave : false, // If true, the server will not save the openapi json spec locally
SwaggerUrl : "/swagger", // URL to serve the swagger ui
JsonUrl : "/swagger/openapi.json", // URL to serve the openapi json spec
JsonFilePath : "doc/openapi.json", // Local path to save the openapi json spec
UIHandler : DefaultOpenAPIHandler, // Custom UI handler
DisableSwagger: false, // If true, the server will not serve the swagger ui nor the openapi json spec
DisableLocalSave: false, // If true, the server will not save the openapi json spec locally
SwaggerUrl: "/swagger", // URL to serve the swagger ui
JsonUrl: "/swagger/openapi.json", // URL to serve the openapi json spec
JsonFilePath: "doc/openapi.json", // Local path to save the openapi json spec
UIHandler: DefaultOpenAPIHandler, // Custom UI handler
}))

fuego.Get(s, "/", func(c fuego.ContextNoBody) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/guides/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func main() {
s := fuego.NewServer(
fuego.WithAddr("localhost:8080"),
fuego.WithOpenAPIConfig(fuego.OpenAPIConfig{
DisableSwagger : true,
DisableSwagger: true,
}),
)

Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/guides/serialization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ReceivedType struct {
func echo(c fuego.ContextWithBody[ReceivedType]) (string, error) {
// Deserialize the HTTP Request body into ReceivedType,
// whether it's application/json, application/xml, application/x-www-form-urlencoded, etc.
received, err := c.Body()
received, err := c.Body()
if err != nil {
return ReceivedType{}, err
}
Expand All @@ -62,7 +62,7 @@ func echo(c fuego.ContextWithBody[ReceivedType]) (string, error) {

If you just want to read the body of the request as a byte slice, you can use the `[]byte` receiver type.

Don't forget to set the request `Content-Type` header to `application/octet-stream`.
Don't forget to set the request `Content-Type` header to `application/octet-stream`.

```go
fuego.Put(s, "/blob", func(c *fuego.ContextWithBody[[]byte]) (any, error) {
Expand All @@ -83,7 +83,7 @@ If you want to bypass the automatic serialization, you can directly write to the
func helloWorld(c fuego.ContextNoBody) (any, error) {
w := c.Response()
w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Hello, World!")) // Write directly to the response writer.
w.Write([]byte("Hello, World!")) // Write directly to the response writer.
_ = json.NewEncoder(w).Encode(MyReturnType{Message: "Hello, World!"}) // You can also use json.NewEncoder(w).Encode to serialize data directly into JSON
fuego.SendJSON(w, MyReturnType{Message: "Hello, World!"}) // Or use fuego.SendJSON to serialize data directly into JSON

Expand Down
1 change: 0 additions & 1 deletion documentation/docs/tutorials/01-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ cd hello-fuego
Then, create a `go.mod` file:

```bash

go mod init hello-fuego
```

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tutorials/rendering/gomponents.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (rs Ressource) adminIngredients(c fuego.ContextNoBody) (fuego.Gomponent, er
return nil, err
}

// highlight-next-line
// highlight-next-line
return admin.IngredientList(ingredients, searchParams), nil
}
```
Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/tutorials/rendering/std.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func (rs Ressource) unitPreselected(c fuego.ContextNoBody) (fuego.HTML, error) {
return "", err
}

// highlight-start
// highlight-start
return c.Render("preselected-unit.partial.html", fuego.H{
"Units": types.UnitValues,
"SelectedUnit": ingredient.DefaultUnit,
})
// highlight-end
// highlight-end
}
```
2 changes: 1 addition & 1 deletion documentation/docs/tutorials/rendering/templ.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (rs Ressource) adminIngredients(c fuego.ContextNoBody) (fuego.Templ, error)
return nil, err
}

// highlight-next-line
// highlight-next-line
return admin.IngredientList(ingredients, searchParams), nil
}
```
Expand Down

0 comments on commit 4b6b12d

Please sign in to comment.