我正在创建REST API。这很简单,但有一些我不明白的事情:
def create
@client = Client.find(params[:client_id])
@project = @client.project.new(project_params)
flash[:notice] = "Project created successfully" if @client.project << @project
respond with @project, location: admin_project_path
end
,/api/v1/auth
/api/v1/user/auth
,/api/v1/signup
使用(GET或POST)更好的方法。或者最好使用api/v1/login
。我在我的示例/api/v1/user/signup|login
中使用,因为我创建了路线:
/api/v1/user - without s
- 为所有用户提供/api/v1/users
- 为用户提供特定ID 我对这条路线是否正确&amp;