-
-
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.
- Loading branch information
Showing
8 changed files
with
792 additions
and
8 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
documentation/docs/guides/controllers.md → documentation/docs/guides/controllers.mdx
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import FlowChart from '@site/src/components/FlowChart'; | ||
|
||
# Controllers | ||
|
||
Controllers are the main way to interact with the application. They are responsible for handling the requests and responses. | ||
|
||
<FlowChart selected="Controller" /> |
5 changes: 5 additions & 0 deletions
5
documentation/docs/guides/errors.md → documentation/docs/guides/errors.mdx
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import FlowChart from '@site/src/components/FlowChart'; | ||
|
||
# Error handling | ||
|
||
Error handling is a crucial part of any application. It is important to handle errors gracefully and provide meaningful feedback to the user. In this guide, we will cover how to handle errors in a Fuego application. | ||
|
||
|
||
<FlowChart selected="ErrorHandler" /> |
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
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
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
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
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,65 @@ | ||
import Mermaid from "@theme/Mermaid"; | ||
import React from "react"; | ||
|
||
const code = `flowchart TB | ||
subgraph fuego | ||
direction LR | ||
subgraph input | ||
direction TB | ||
req(Request) -- JSON {'a':'value '} --> Deserialization | ||
Deserialization -- struct{A:'value '} --> InTransformation | ||
InTransformation -- struct{A:'My Value'} --> Validation | ||
end | ||
subgraph output | ||
direction TB | ||
b(Controller) -- struct{B:'Response'} --> OutTransformation | ||
OutTransformation -- JSON {'b':'Response!'} --> Serialization | ||
end | ||
Controller{{Controller}} | ||
input -- struct{A:'My Value'} --> Controller -- struct{B:'Response'} --> output | ||
output --> ress(Response) | ||
input -- error --> ErrorHandler | ||
Controller -- error --> ErrorHandler | ||
output -- error --> ErrorHandler | ||
click Controller "/fuego/docs/guides/controllers" "Controllers" | ||
click Validation "/fuego/docs/guides/validation" "Controllers" | ||
click InTransformation "/fuego/docs/guides/transformation" "Transformation" | ||
click OutTransformation "/fuego/docs/guides/transformation" "Transformation" | ||
click ErrorHandler "/fuego/docs/guides/errors" "Error Handling" | ||
end | ||
Request -- JSON {'a':'value '} --> fuego | ||
fuego -- JSON {'b':'Response!'} --> Response | ||
fuego -- JSON {'error':'Error message', 'code': 4xx} --> Response | ||
`; | ||
|
||
export function FlowChart({ selected }) { | ||
let style = ""; | ||
if (selected && typeof selected === "string") { | ||
if (selected === "Transformation") { | ||
style += | ||
`style InTransformation stroke:#f33,stroke-width:4px` + | ||
"\n" + | ||
`style OutTransformation stroke:#f33,stroke-width:4px`; | ||
} else { | ||
style += `style ${selected} stroke:#f33,stroke-width:4px`; | ||
} | ||
} | ||
|
||
return <Mermaid value={code + style} />; | ||
} | ||
|
||
export default FlowChart; |
Oops, something went wrong.