From 753291fc0135e4b9c598f7e32d5dd651fe05ee53 Mon Sep 17 00:00:00 2001 From: Fedi Rajhi Date: Sat, 7 Dec 2024 19:13:19 +0100 Subject: [PATCH] Update flowchart routing.md (#906) --- docs/technical/routing.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/technical/routing.md b/docs/technical/routing.md index 4b150de01..3c36101e1 100644 --- a/docs/technical/routing.md +++ b/docs/technical/routing.md @@ -124,13 +124,13 @@ In all other cases, we attempt to retrieve the next phase, based on the current flowchart TD checkPhase[check phase] --for each route--> checkRoute checkRoute[check route] -->|error| checkPhase - checkRoute -->|done| phaseHitMiss{is phase\nhit or miss?} + checkRoute -->|done| phaseHitMiss{is phase
hit or miss?} phaseHitMiss --> |phase == hit| matchingDone[matching done] phaseHitMiss --> |phase == miss| set404[set 404] - phaseHitMiss --> |phase not neither| nextPhaseIsWhat{path found\nor\nphase == miss/error} - set404 --> nextPhaseIsWhat{path found\nsuccessfully?} - nextPhaseIsWhat --> |yes\nset next phase to hit| checkPhase - nextPhaseIsWhat --> |no\nset next phase| checkPhase + phaseHitMiss --> |phase not neither| nextPhaseIsWhat{path found
or
phase == miss/error} + set404 --> nextPhaseIsWhat{path found
successfully?} + nextPhaseIsWhat --> |yes
set next phase to hit| checkPhase + nextPhaseIsWhat --> |no
set next phase| checkPhase ``` ### Checking Source Routes @@ -209,22 +209,22 @@ After all of the above has been completed, the final part to check for a (matchi flowchart TD checkRoute --> CheckSourceMatch{path matches source?} CheckSourceMatch -->|yes| ApplyOverrides[apply overrides] - CheckSourceMatch -->|no| EndRoutingSkip[`skip`] - ApplyOverrides --> ApplyInternationalization[apply internationalization\nredirects] + CheckSourceMatch -->|no| EndRoutingSkip[skip] + ApplyOverrides --> ApplyInternationalization[apply internationalization
redirects] ApplyInternationalization --> HasMiddleware{has middleware} HasMiddleware --> |yes| RunMiddlewareResult{run middleware} - HasMiddleware --> |no| ApplyHeadersStatusAndDestination[apply route headers\napply status code\napply destination] - RunMiddlewareResult --> |success| ApplyMiddlewareHeaders[apply middleware\nheaders] - RunMiddlewareResult --> |error| EndRoutingError[`error`] + HasMiddleware --> |no| ApplyHeadersStatusAndDestination[apply route headers
apply status code
apply destination] + RunMiddlewareResult --> |success| ApplyMiddlewareHeaders[apply middleware
headers] + RunMiddlewareResult --> |error| EndRoutingError[error] ApplyMiddlewareHeaders --> ApplyHeadersStatusAndDestination ApplyHeadersStatusAndDestination --> ShouldCheck{route.check == true} - ShouldCheck --> |yes| PathsEqual{current path\n==\nrewritten path} - PathsEqual --> |yes\n+\nphase = miss| Return404[set status to 404] --> ShouldContinue - PathsEqual --> |yes\n+\nphase != miss| checkNextPhase[check next phase] - PathsEqual --> |no| checkNonePhase[check `none` phase] - ShouldCheck --> |no| ShouldContinue{should continue\n and has no\nredirect} - ShouldContinue --> |yes| ReturnNext[`next`] - ShouldContinue --> |no| ReturnDone[`done`] + ShouldCheck --> |yes| PathsEqual{current path
==
rewritten path} + PathsEqual --> |yes
+
phase = miss| Return404[set status to 404] --> ShouldContinue + PathsEqual --> |yes
+
phase != miss| checkNextPhase[check next phase] + PathsEqual --> |no| checkNonePhase[check none phase] + ShouldCheck --> |no| ShouldContinue{should continue
and has no
redirect} + ShouldContinue --> |yes| ReturnNext[next] + ShouldContinue --> |no| ReturnDone[done] ``` ### Serving Responses @@ -243,11 +243,11 @@ Finally, we return the response. ```mermaid flowchart TD - serve --> checkRedirect{check for\n`location`\nheader} + serve --> checkRedirect{check for
location
header} checkRedirect --> |found| returnRedirect[return redirect response] checkRedirect --> |not found| fetchItemFromOutput[fetch item from build output] fetchItemFromOutput --> applySearchParams[apply search params to request] - applySearchParams --> retrieveResponseForItem{fetch item\nresponse} + applySearchParams --> retrieveResponseForItem{fetch item
response} retrieveResponseForItem --> |success| applyHeadersAndStatus[apply headers + status] retrieveResponseForItem --> |error| returnError[return error response] applyHeadersAndStatus --> returnResponse[return final response object]