REST API : with Apache http web/content server Sinatra Passenger app server

我的未来我决定 提交于 2019-12-11 12:27:10

问题


I am totally newbiew to REST API and from all reading, got a little bit hands on with Sinatra as it looks really simple in terms of the syntax.

However i am a little bit confused as to how a entire 3 tier set up with http web server and app server work. I am planning to learn by writing a simple web application which goes a little more than "hello world" .

My setup I have 2 html page lets say a.html and b.html. a.html is my home page and I set it in htdocs i.e using Apache.

In a.html i click on a button . Now this button click calls a http get to a particular route say a.html/files . now this route is defined inside my Sinatra ruby code in Passenger and it returns a JSON object that must be consumed by b.html and b.html is the next page that the client must see.

So I am a bit confused, if I am calling the route a.html/files and it returns a JSON , how do i route it to b.html to consume it and how does the client now see b.html?. i.e the web browser must be redirected to b.html with the JSON object parsed in its JavaScript and displayed . But how will this happen if the client had called a.html/files and there is no mention of b.html here.

This very basic point is where i am stuck :(

来源:https://stackoverflow.com/questions/30139933/rest-api-with-apache-http-web-content-server-sinatra-passenger-app-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!