Skip to content

fengwenyi/api-result

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-result

一套RESTful风格API接口响应参数规范化的解决方案。

特性

  • 规范化。
  • 统一化。
  • 标准化。

快速开始

Maven

<dependency>
    <groupId>com.fengwenyi</groupId>
    <artifactId>api-result</artifactId>
    <version>2.7.5</version>
</dependency>

代码示例

@RestController
@RequestMapping("/api")
public class ApiController {

    @RequestMapping("/demo")
    public ResultTemplate<Void> demo() {
        return ResultTemplate.success();
    }

}

请求

curl http://localhost:8080/api/demo

响应示例

{
  "code":"SUCCESS",
  "message":"Success",
  "success":true,
  "header":null, 
  "body":null, 
  "date":"2022-07-16T20:21:23.017"
}

其他