rest - Accessing JSON Resource on a RESTful one page app -
given 1 page app uses push state , restful backend, can imagine accessing listing of resource @ /resourcename (i.e. /users). /users create formated list of users
now problem resource json or xml feed should mapped /resourcename, if boot form application entry point @ / good, when navigating /users js router can trigger ajax call json data. problem if url pointing directly @ /users land on json feed instead of actual listing. route call main entry point , let js router work though if ajax call fetch json wil brake.
i remember while ago people adding .json json request, or parameter ?format=json , having controller taking different actions. find hacky.. there other ways go this?
for matter using laravel4 backend , backbonejs
i think .json on end of request best approach. other approach create separate endpoint endpoint api request api.mydomain.com vs www.mydomain.com
Comments
Post a Comment