This repo demonstrates the best practice in own work, including:
- backend response in restful style;
- distinguish http status;
- distinguish response body code;
- response body code != 200, extract response body message to show;
- response body code == 200, extract response body data to render;
---
title: flowchart
---
flowchart TB
Start[/Start/]
HttpCode{HttpCode == 200?}
Start --> HttpCode
HttpError[HttpError]
HttpCode -->|No| HttpError
Stop[/Stop/]
HttpError --> Stop
HttpOk[HttpOk 200]
HttpCode --> |Yes| HttpOk
HttpOk --> RespCode
RespCode{RespCode == 200?}
RespError[RespError]
RespCode -->|No| RespError
RespOk[RespOk 200]
RespCode --> |Yes| RespOk
RespData[extract Resp Data]
RespOk --> RespData
RespData --> Stop
RespMsg[extract Resp Msg]
RespError --> RespMsg
RespMsg --> Stop