Skip to content

hanzhang2566/best-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

best-practice

中文文档

This repo demonstrates the best practice in own work, including:

  • backend response in restful style;

Backend Response in Restful Style

  1. distinguish http status;
  2. distinguish response body code;
  3. response body code != 200, extract response body message to show;
  4. 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
Loading

Bean Validation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages