-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds documentation for the architecture of Fuego and how to use it wi…
…th Gin.
- Loading branch information
Showing
5 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
documentation/docs/guides/alternative-routers-support/gin.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Using Fuego with Gin | ||
|
||
Fuego can be used with Gin by using the `fuegogin` adaptor. | ||
|
||
Instead of using the **Server** (`fuego.NewServer()`), you will use the **Engine** (`fuego.NewEngine()`) along with your router. | ||
|
||
The usage is similar to the default server, but you will need to declare the routes with `fuegogin.Get`, `fuegogin.Post`... instead of `fuego.Get`, `fuego.Post`... | ||
|
||
## Migrate incrementally | ||
|
||
1. Spawn an engine with `fuego.NewEngine()`. | ||
2. Use `fuegogin.GetGin` instead of `gin.GET` to wrap the routes with OpenAPI declaration of the route, **without even touching the existing controllers**!!! | ||
3. Replace the controllers **one by one** with Fuego controllers. You'll get complete OpenAPI documentation, validation, Content-Negotiation for each controller you replace! | ||
4. Enjoy the benefits of Fuego with your existing Gin application! | ||
|
||
## Example | ||
|
||
Please refer to the [Gin example](https://github.com/go-fuego/fuego/tree/main/examples/gin-compat) for a complete and up-to-date example. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Architecture | ||
|
||
Fuego's architecture rely on the following components: | ||
|
||
- **Engine**: The engine is responsible for handling the request and response. It is the core of Fuego. | ||
- It contains the **OpenAPI** struct with the Description and OpenAPI-related utilities. | ||
- It also contains the centralized Error Handler. | ||
- **Server**: The default `net/http` server that Fuego uses to listen for incoming requests. | ||
- Responsible for routes, groups and middlewares. | ||
- **Adaptors**: If you use Gin, Echo, or any other web framework, you can use an adaptor to use Fuego with them. | ||
- **Context**: The context is a generic typed interface that represents the state that the user can access & modify in the controller. | ||
|
||
![Fuego Architecture](./architecture.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "⚙ Internals & Contributing", | ||
"position": 4, | ||
"link": { | ||
"type": "generated-index" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.