I have a normal Umbraco site with some company info. On this site Im about to create a web app (angularjs) that gonna use an API from another domain.
Since I wont be able to get stuff from the other domain (CORS), what is the best way to create an API on the Umbraco site that gets data from the other domain and makes it accessible to my web app with ajax calls.
Example:
In my webapp (www.mysite.com) I want to get all products from (api.somedomain.com/products).
I want to be able to do an ajax call to www.mysite.com/api/products and that should call a controller that returns products from api.somedomain.com/products.
I wont need to return any umbraco content so I dont know if UmbracoApiController is the way to go?
Custom API controller/route
I have a normal Umbraco site with some company info. On this site Im about to create a web app (angularjs) that gonna use an API from another domain. Since I wont be able to get stuff from the other domain (CORS), what is the best way to create an API on the Umbraco site that gets data from the other domain and makes it accessible to my web app with ajax calls.
Example: In my webapp (www.mysite.com) I want to get all products from (api.somedomain.com/products). I want to be able to do an ajax call to www.mysite.com/api/products and that should call a controller that returns products from api.somedomain.com/products.
I wont need to return any umbraco content so I dont know if UmbracoApiController is the way to go?
I think the UmbracoApiController is still a good idea because that will handle the routing for you. More info: http://our.umbraco.org/documentation/Reference/WebApi/
Jeroen
is working on a reply...