简体   繁体   English

Ruby on Rails API和Web服务

[英]Ruby on Rails API and web services

I am fairly new to web application development and I have a pretty noob question. 我是Web应用程序开发的新手,我有一个很菜鸟的问题。 As I understand, it is possible to write the backend of a web application - models, business logic, etc. using Rails and write the backend - the view - using just HTML, CSS Javascript (without using Rail's form helpers, embedded ruby, etc.) and that the said view would render data exposing a Rails API and making AJAX requests to it. 据我了解,可以使用Rails编写Web应用程序的后端-模型,业务逻辑等,而仅使用HTML,CSS Javascript编写后端-视图-(无需使用Rail的表单助手,嵌入式ruby等) 。),并且该视图将呈现公开Rails API并向其发出AJAX请求的数据。 Everytime I googled "rails ajax requests API" I have only found tutorials that explain how to use AJAX w/ embedded ruby instead of tutorials that clearly separate how to make a Rails API and make AJAX requests to render data. 每次我搜索“ rails ajax请求API”时,我只会找到说明如何使用带嵌入式红宝石的AJAX的教程,而不是清楚地区分如何制作Rails API和提出AJAX请求以呈现数据的教程。 So my questions are: 所以我的问题是:

1) If any of the above statements are incorrect, could you let me know? 1)如果以上任何陈述都不正确,您能告诉我吗?

2) Can someone point me to tutorials that help me understand the theory and implementation of the aforementioned topics? 2)有人可以指出我的教程来帮助我理解上述主题的理论和实现吗?

Thanks! 谢谢!

The REST API generated by Rails can be consume by any client, if you want to use pure HTML and CSS withouth the .erb files (for me brings many advantages when developing) you can access to the Rails API data by AJAX . Rails生成的REST API可以被任何客户端使用,如果您想使用纯HTML和CSS而没有.erb文件(对我来说在开发时会带来很多好处),则可以通过AJAX访问Rails API数据

I let you the following tutorial: 我给你下面的教程:

http://blog.project-sierra.de/archives/1788 http://blog.project-sierra.de/archives/1788

Hope it helps 希望能帮助到你

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

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