Joined February 2012
·

Simon Wood

Ashford, Kent UK
·
·
·

Some great tips there. Only thing I would as is don't do pagination with limit and offset. Instead use a 'next' and 'previous' and use and offset. Either time off or ID offset. See some of the conversation here it explains better then me.

http://stackoverflow.com/questions/13872273/api-pagination-best-practices

With constantly updating data limit and offset will mean missed data when moving from page to page.

Posted to PHP has standards, USE THEM! over 1 year ago

I find it is best to define Coding Standards at a company/organisation level. Ever where I have worked has either had Coding Standards or I have introduced them.

The PHP Standers in our company are similar to FIG, but there are a number of differences. Notably "Opening braces for classes MUST go on the next line" we do not agree with. We have the rule "Opening braces for classes MUST go on the same line the same as conditional statements".

If FIG would just change that, the rest of it seams to be OK.

A few comments. We have created lots of API's both with Node.js and Express, but also in PHP with Slim.

Slim is nice for building RESTful JSON API's. I find Slim paired with an ORM makes for an awesome tool kit for coding API's quickly. Also I would take out the "status":200 and use HTTP Headers to make it true REST.

Great tip though, more people should check out Slim.

Posted to Me, my self and that over 1 year ago

I agree. self is the only acceptable var name. We only use

var self = this;

in all out Node.js code and backbone code.

Achievements
59 Karma
0 Total ProTip Views