richardschneider / yappy

Yet another REST API server howling at the moon with JSON
MIT License
2 stars 0 forks source link

BSON request/response #14

Open richardschneider opened 8 years ago

richardschneider commented 8 years ago

Would BSON instead of JSON be a more compact representation for #6?

richardschneider commented 8 years ago

https://www.npmjs.com/package/bson looks like the package to use.

And there's a new kid on the block http://ubjson.org/

richardschneider commented 8 years ago

There is no official content-type for BSON, but most people are expecting application/bson or application/xxx+bson.

richardschneider commented 8 years ago

There doesn't appear to be any content negotiation middleware available in express. The only thing I've seen is at the route layer (https://github.com/cleishm/express-negotiate) which violates separation of concern.

Maybe adding a express-mung is the way to go.

richardschneider commented 8 years ago

To convert our application/json response to application/bson the HTTP header Accept or query parameter ?format could be used.