Skip to content

Commit f5471c2

Browse files
authored
Update README.md
1 parent 9cee8ce commit f5471c2

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ HTTP APIs can be exposed to public network and be under control, and can easily
2121
</repository>
2222
</repositories>
2323
```
24+
25+
![image](https://user-images.githubusercontent.com/5738175/167263399-339dad4f-2884-461e-9781-f2de6d100340.png)
26+
2427
<br />
2528

2629
#### 2. 在 pom.xml 中添加 apijson-router 依赖
@@ -33,6 +36,12 @@ HTTP APIs can be exposed to public network and be under control, and can easily
3336
</dependency>
3437
```
3538

39+
![image](https://user-images.githubusercontent.com/5738175/167263390-f3cc8fed-9fd5-4ee1-b8d1-e2d1a695b16c.png)
40+
41+
<br />
42+
43+
https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource/pom.xml
44+
3645
<br />
3746
<br />
3847

@@ -42,7 +51,6 @@ HTTP APIs can be exposed to public network and be under control, and can easily
4251
```gradle
4352
allprojects {
4453
repositories {
45-
...
4654
maven { url 'https://jitpack.io' }
4755
}
4856
}
@@ -65,16 +73,41 @@ HTTP APIs can be exposed to public network and be under control, and can easily
6573

6674
#### 1.新增一个 @RestController class DemoController extends APIJSONRouterController
6775
#### 1.Add a @RestController class DemoController extends APIJSONRouterController
76+
```java
77+
@RestController
78+
@RequestMapping("")
79+
public class DemoController extends APIJSONRouterController<Long> {
80+
}
81+
```
82+
![image](https://user-images.githubusercontent.com/5738175/167263296-3bfd8782-c163-4461-bbed-f264be529e76.png)
6883

6984
<br />
7085

7186
#### 2.在 DemoController 重写 router 方法,加上注解 @PostMapping("router/{method}/{tag}")
7287
#### 2.Override router in DemoController, and add @PostMapping("router/{method}/{tag}") for router method
88+
```java
89+
@PostMapping("router/{method}/{tag}")
90+
@Override
91+
public String router(@PathVariable String method, @PathVariable String tag, @RequestParam Map<String, String> params, @RequestBody String request, HttpSession session) {
92+
return super.router(method, tag, params, request, session);
93+
}
94+
```
95+
96+
![image](https://user-images.githubusercontent.com/5738175/167263339-7c7cce6e-25bf-47b1-86a3-fc2950b8938d.png)
7397

7498
<br />
7599

76100
#### 3.在 DemoApplication.main 方法内,APIJSONAppication.init 后调用 APIJSONRouterApplication.init
77101
#### 3.In DemoApplication.main, call APIJSONRouterApplication.init after APIJSONAppication.init
102+
```java
103+
public static void main(String[] args) throws Exception {
104+
SpringApplication.run(DemoApplication.class, args);
105+
APIJSONApplication.init();
106+
APIJSONRouterApplication.init();
107+
}
108+
```
109+
110+
![image](https://user-images.githubusercontent.com/5738175/167263261-25fc5a02-7980-443f-94d9-76d2b488ce61.png)
78111

79112
<br />
80113

@@ -100,7 +133,7 @@ See document in [APIJSONRouterController](/src/main/java/apijson/router/APIJSONR
100133
### 1.Add mapping rule in table Document
101134

102135
例如 <br />
103-
Eg <br />
136+
E.g. <br />
104137

105138
name: 查询动态列表
106139

@@ -146,7 +179,7 @@ This step can be ignored if validation is not needed. <br />
146179
The same as common APIJSON requests, but won't wrap structure with tag to "Table": structure <br />
147180

148181
例如 <br />
149-
Eg <br />
182+
E.g. <br />
150183

151184
method: GET
152185

@@ -186,7 +219,7 @@ POST {base_url}/router/get/{tag} // tag 可为任意符合变量名格式的字
186219
```
187220

188221
例如 <br />
189-
Eg <br />
222+
E.g. <br />
190223

191224
POST http://localhost:8080/router/get/momentList // 对应 Document 表配置的 url
192225
```js

0 commit comments

Comments
 (0)