Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any frameworks for creating proper REST (i.e. Hypermedia) interfaces in NodeJS?

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?

like image 356
Doug Moscrop Avatar asked Oct 17 '13 22:10

Doug Moscrop


2 Answers

To create adhoc hypermedia-compliant resources in the HAL format I'd reccomend the HAL npm package

like image 173
Pedro Montoto García Avatar answered Nov 15 '22 17:11

Pedro Montoto García


I believe you'll be happier with http://mcavage.me/node-restify/ then building something yourself on top of Express.

like image 27
Dan Kohn Avatar answered Nov 15 '22 19:11

Dan Kohn