我正在探索 Ballerina 来构建 API,并利用其声明式风格来定义端点和服务。然而,我面临着管理长嵌套路径的挑战,如下面的结构所示:
/api/v1/ - with interceptor
- a GET, POST
- a/:aId GET, PATCH, DELETE
- a/:aId/b GET, POST
- a/:aId/b/:bId GET, PATCH, DELETE ( need an interceptor at this level )
- a/:aId/b/:bId... goes on to 4-6 levels of nested resources
- several top level resources similar to /api/v1/a
目前,我已将这些路径组织成多个服务文件。
我有以下问题:
以上三个问题的答案如下: