瀏覽代碼

📝 docs(commands): update generic-crud-extend.md with route ordering note

- adjust route registration order in example to place base CRUD routes last
- add comment explaining that base CRUD routes must be placed last to prevent overriding custom routes
yourname 3 月之前
父節點
當前提交
fea95eb62d
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      .roo/commands/generic-crud-extend.md

+ 2 - 2
.roo/commands/generic-crud-extend.md

@@ -288,10 +288,10 @@ const yourEntityRoutes = createCrudRoutes({
 
 // 2. 聚合所有路由(保持链式)
 const app = new OpenAPIHono()
-  .route('/', yourEntityRoutes)              // 基础CRUD路由
   .route('/batch', batchDeleteRoute)        // 批量操作路由
   .route('/:id/status', statusUpdateRoute)  // 状态更新路由
-  .route('/export', exportRoute);           // 导出路由
+  .route('/export', exportRoute)          // 导出路由
+  .route('/', yourEntityRoutes);               // 基础CRUD路由必需放最后,不然自定义路由会覆盖掉基础CRUD路由
 
 // 3. 导出聚合后的路由
 export default app;