简体   繁体   English

rails 3中的Restful API

[英]Restful API in rails 3

How should I go about creating a restful API in rails 3 app? 我应该如何在rails 3 app中创建一个安静的API? Also I would like to know if there is a good way to implement restful authentication 另外我想知道是否有一种很好的方法来实现restful身份验证

Restful API in rails 3? rails 3中的Restful API? Rails is restful.. just use routes [ guide ] Rails很安静..只需使用路线[ 指南 ]

As for authentication, i strongly recommend devise . 至于身份验证,我强烈建议设计 It's also the only one I have managed to get working on rails 3. 它也是唯一能够在rails 3上工作的人。

如果您正在寻找一种方法来验证使用您的API的应用程序,请查看restful_api_authentication gem - https://rubygems.org/gems/restful_api_authentication

The easiest way to create RESTful authentication in Rails is the combination of a User Model and a Session controller. 在Rails中创建RESTful身份验证的最简单方法是组合用户模型和会话控制器。 So you will have new(login), create(authenticate), destroy(logout) actions in the Session controller. 因此,您将在会话控制器中进行新的(登录),创建(身份验证),销毁(注销)操作。 Depending on the app its fairly easy to write your own authentication. 根据应用程序,它很容易编写自己的身份验证。 This screencast shows how easy it is. 这个截屏视频显示它是多么容易。 Authentication in Rails 3.1 Rails 3.1中的身份验证

你可以使用插件葡萄

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM