Wednesday, 15 January 2014

javascript - Transforming api json responses for NodeJS -



javascript - Transforming api json responses for NodeJS -

i'm ending having hacks convert 'true' true , it's creating code smell.

is there library https://github.com/thephpleague/fractal allows me transform response types need?

in cases it's improve prepare api homecoming info in usable format rather trying post-process result on client.

in case there several routes take:

store list json string straight in database.

this means don't have processing on server , can homecoming 'as is'. lose ability queries on info straight , need resort things like , string operations.

store info relationally, , process on server turn json

here retain ability queries on data, may need several queries info need , connect on server. (eg. 1 select on user table user, , need select on friends table userid matches first user. need merge these results create json.) best way it.

you can turn result json straight within database engine using user defined function. illustration using https://github.com/mysqludf/lib_mysqludf_json#readme

this similar 2, ties stored procs json format.

javascript json node.js

No comments:

Post a Comment