feat(api-gateway): 添加content服务代理路由
main.go添加textbooks/chapters/knowledge-points/questions四组路由 config.go新增ContentServiceURL字段 docs: known-issues记录P4 content端到端验证经验
This commit is contained in:
@@ -93,6 +93,21 @@ func main() {
|
||||
api.Any("/homework/*path", coreEduHandler)
|
||||
api.Any("/grades", coreEduHandler)
|
||||
api.Any("/grades/*path", coreEduHandler)
|
||||
|
||||
// content 服务路由(教材/章节/知识点/题库)
|
||||
contentProxy, err := proxy.NewProxy(cfg.ContentServiceURL)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create content proxy: %v", err)
|
||||
}
|
||||
contentHandler := proxy.ProxyHandler(contentProxy)
|
||||
api.Any("/textbooks", contentHandler)
|
||||
api.Any("/textbooks/*path", contentHandler)
|
||||
api.Any("/chapters", contentHandler)
|
||||
api.Any("/chapters/*path", contentHandler)
|
||||
api.Any("/knowledge-points", contentHandler)
|
||||
api.Any("/knowledge-points/*path", contentHandler)
|
||||
api.Any("/questions", contentHandler)
|
||||
api.Any("/questions/*path", contentHandler)
|
||||
}
|
||||
|
||||
srv := &http.Server{
|
||||
|
||||
Reference in New Issue
Block a user