# 路由

## 配置前后端分离

当我们快速启动一个Rails项目时，rails g scaffold是最好的工具，马上就能生成CRUD页面。但是，CRUD功能往往都是管理端需要，前端最多的还是Index和Show页面。为了实现前后端代码分离，我们把所有前端controller/view放到frontend目录，rails g scaffold生成的作为管理端。配置routes.rb的代码如下：

![](/files/-LJHyJ0FbrX5zR3yC00m)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.tanmer.cn/gem/ruby-on-rails/lu-you.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
