I'm a bit overwhelmed with the number of frameworks or express/connect middleware pieces that claim they offer REST support, but are really more about "auto CRUD"
Are there any examples that demonstrate returning framework formed hyperlinks to other resources in responses? For example, consider
/comments
where I can POST a message. After I persist the comment, the client may be able to retrieve it from
/comment/:id
... but ideally I want to return the actual URI of the created comment from the comments collection resource (as well as many other URIs to satisfy HATEOAS), a la POST-Then-GET ... sure, it's not impossible if you're willing to throw string concatenations all over the place.
Having played with Ember, I'd love to have something similar to the way they handle routes, but on the server side, so that I can simply refer to routes/resources by internal name, and leave the URI templating to the router.
Does that make sense? Is this possible and I've horribly overlooked it?
To create adhoc hypermedia-compliant resources in the HAL
format I'd reccomend the HAL npm package
I believe you'll be happier with http://mcavage.me/node-restify/ then building something yourself on top of Express.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With