Take the 2-minute tour ×

I'm working on a project which involves a website, and after that is done, mobile applications (most probably will be built using a cross-platform tool like Phonegap or Sencha).

The overall application is heavily data-driven, all of which will be stored in MySQL databases on our webserver. I know that I will be setting up a REST API as a service layer for the mobile applications, but what I'm not sure about it - Should I be using this API for the main website as well?

I need to know this before I can begin the project, because if I do intend to eat my own dogfood, then the API will be the first priority.

In case it matters - the API will never be exposed to third party developers.

share|improve this question
@PST: changed to something more descriptive of the issue at hand –  xbonez Apr 15 '12 at 0:43
add comment

2 Answers

up vote 2 down vote accepted

Yes you should use the API for the website. It simplifies your codebase and encourages code reuse, since you only deal with one API and not two (REST + MySQL). Furthermore, it makes life easier on the developers (that includes you!), because there is only one set of API calls to keep in mind at once.

Also, in the future you may build your mobile apps with HTML (perhaps using PhoneGap, recently open-sourced and renamed to Cordova). If your website uses the REST API, you can more easily port the web code to HTML5 for mobile.

Nitpick: This isn't really a matter of eating your own dogfood. Dogfooding typically refers to using pre-release code from the perspective of a user rather than a developer, to make finding bugs easier.

share|improve this answer
Thanks. It definitely sounds 'cleaner' to be dealing and developing only a single API. –  xbonez Apr 15 '12 at 1:27
add comment

Sure, why not? It means that you'll have only one entry-point to test and monitor, it follows the DRY principle, and it will encourage better API design if you consume it too.

share|improve this answer
add comment

Your Answer


