diff --git a/documentation/docs/guides/middlewares.md b/documentation/docs/guides/middlewares.md index 0a1aa676..c0acfdb0 100644 --- a/documentation/docs/guides/middlewares.md +++ b/documentation/docs/guides/middlewares.md @@ -75,7 +75,6 @@ func main() { // Requests to / will NOT! go through the middleware fuego.Get(s, "/", myController) - s.Run() } ``` @@ -90,7 +89,6 @@ package main import ( "github.com/go-fuego/fuego" - "net/http" ) func main() { diff --git a/documentation/docs/guides/openapi.md b/documentation/docs/guides/openapi.md index 0d8271b6..867f840a 100644 --- a/documentation/docs/guides/openapi.md +++ b/documentation/docs/guides/openapi.md @@ -56,7 +56,6 @@ func main() { func helloWorld(c fuego.ContextNoBody) (string, error) { return "Hello, World!", nil } - ``` ## Output @@ -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) { diff --git a/documentation/docs/guides/options.md b/documentation/docs/guides/options.md index e5b51bf8..d2ccde16 100644 --- a/documentation/docs/guides/options.md +++ b/documentation/docs/guides/options.md @@ -13,7 +13,7 @@ func main() { s := fuego.NewServer( fuego.WithAddr("localhost:8080"), fuego.WithOpenAPIConfig(fuego.OpenAPIConfig{ - DisableSwagger : true, + DisableSwagger: true, }), ) diff --git a/documentation/docs/guides/serialization.mdx b/documentation/docs/guides/serialization.mdx index cbfa2da0..3c3ab21b 100644 --- a/documentation/docs/guides/serialization.mdx +++ b/documentation/docs/guides/serialization.mdx @@ -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 } @@ -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) { @@ -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 diff --git a/documentation/docs/tutorials/01-hello-world.md b/documentation/docs/tutorials/01-hello-world.md index 853b698a..693129ec 100644 --- a/documentation/docs/tutorials/01-hello-world.md +++ b/documentation/docs/tutorials/01-hello-world.md @@ -26,7 +26,6 @@ cd hello-fuego Then, create a `go.mod` file: ```bash - go mod init hello-fuego ``` diff --git a/documentation/docs/tutorials/rendering/gomponents.md b/documentation/docs/tutorials/rendering/gomponents.md index b2e855ee..2c10d08f 100644 --- a/documentation/docs/tutorials/rendering/gomponents.md +++ b/documentation/docs/tutorials/rendering/gomponents.md @@ -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 } ``` diff --git a/documentation/docs/tutorials/rendering/std.md b/documentation/docs/tutorials/rendering/std.md index f39f475c..39265608 100644 --- a/documentation/docs/tutorials/rendering/std.md +++ b/documentation/docs/tutorials/rendering/std.md @@ -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 } ``` diff --git a/documentation/docs/tutorials/rendering/templ.md b/documentation/docs/tutorials/rendering/templ.md index b589962f..cea4f26c 100644 --- a/documentation/docs/tutorials/rendering/templ.md +++ b/documentation/docs/tutorials/rendering/templ.md @@ -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 } ```