开发者

How to design single page application in javascript to work in environment mode?

I'm developing single page application in javascript and consume data fr开发者_Go百科om RESTful web service. I host it on simple lighttpd web server. I want to have different url for consuming data by environment like development mode points to my local web service and production mode point to online webservice.


Route all XMLHttpRequest through a wrapper. In this wrapper, initialize the environment that basically sets the base URL for all outgoing requests. Since you're using a RESTful design, I suppose the URIs are going to be the same for each environment, only the base path is going to change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜