forked from ModelEngine-Group/DataMate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApiGatewayApplication.java
More file actions
64 lines (51 loc) · 2.41 KB
/
ApiGatewayApplication.java
File metadata and controls
64 lines (51 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.datamate.gateway;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
/**
* API Gateway & Auth Service Application
* 统一的API网关和认证授权微服务
* 提供路由、鉴权、限流等功能
*/
@SpringBootApplication
@ComponentScan(basePackages = {"com.datamate"})
@MapperScan(basePackages = {"com.datamate.**.mapper"})
public class ApiGatewayApplication {
public static void main(String[] args) {
SpringApplication.run(ApiGatewayApplication.class, args);
}
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
// 数据合成服务路由
.route("data-synthesis", r -> r.path("/api/synthesis/**")
.uri("http://datamate-backend-python:18000"))
// 数据标注服务路由
.route("data-annotation", r -> r.path("/api/annotation/**")
.uri("http://datamate-backend-python:18000"))
// 数据评估服务路由
.route("data-evaluation", r -> r.path("/api/evaluation/**")
.uri("http://datamate-backend-python:18000"))
// 数据归集服务路由
.route("data-collection", r -> r.path("/api/data-collection/**")
.uri("http://datamate-backend-python:18000"))
.route("deer-flow-frontend", r -> r.path("/chat/**")
.uri("http://deer-flow-frontend:3000"))
.route("deer-flow-static", r -> r.path("/_next/**")
.uri("http://deer-flow-frontend:3000"))
.route("deer-flow-backend", r -> r.path("/deer-flow-backend/**")
.filters(f -> f.stripPrefix(1).prefixPath("/api"))
.uri("http://deer-flow-backend:8000"))
// 网关服务(用户)
.route("gateway", r -> r.path("/api/user/**")
.uri("http://localhost:8080"))
// 其他后端服务
.route("default", r -> r.path("/api/**")
.uri("http://datamate-backend:8080"))
.build();
}
}