I\'ll try to keep this question as specific as possible.. I\'m about to start bu
ID: 646191 • Letter: I
Question
I'll try to keep this question as specific as possible..
I'm about to start building an API for an upcoming project. I'm currently thinking PHP/Symfony2. It will be a farily simple HTTP-based api for CRUD on the site's models (and relationships between them).
There will also need to be a CMS for users. Traditionally when building a CMS (if it's bespoke) I'd just use some standard MVC based approach, but for this particular project I'm thinking I could build it using Ajax calls to the API that will already exist.
My question is essentially to decide which way to go, but to keep it specific I'd like to know what drawbacks there might be.
In favour of this, it should reduce duplication of controller logic, why have /api/model/save/ and /cms/model/save doing very similar things?
Currently the only two drawbacks I can think of are that:
It may be hard to support a wide range of browsers. For this particular scenario, this shouldn't be a problem - but who knows what might happen in the future?
Some parts of the site would require traditional PHP logic or an extension to the API (for any parts not part of the core API itself), for example to handle admin authentication.
Is there anything I've missed, some overwhelming reason not to take this approach?
Explanation / Answer
I don't know the particulars of the project, but I think your main problem is this:
Do you trust your user with everything?
If you use AJAX, the user may alter it and call your API in an undesired way. Which, in turn, means that you have to design your API so that it's secure. That would definitely slow you down.
I'd advise you to not do it, unless it's a research example: there's too much to loose and too many ways to screw it up.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.