4 ms·
Thanks for the reply, my next project is going to be doing the REST services with Node. I have been using Java for my services because until Node I really did n
by kls 16y ago
Thanks for the reply, my next project is going to be doing the REST services with Node. I have been using Java for my services because until Node I really did not see a big enough reason to move platforms. What are you using for your REST services implementation, a Node library or did you roll your own? I did not know about Paperboy so thanks for pointing me to that project.
- pilif 16y agoin this case, the API was so simple, I could easily roll my own (it's not even a real framework - I have one resource, the alias and I allow basically just POST to /aliases to create one at the moment). The beauty about node is that it's so simple to extend and add the functionality you need. No magic, no huge framework to learn. The little things you get though work awesomely well and are a pleasure to use.
- kls 16y agoIf you could find the time to shot me an email (possible with some samples, or some links) of how you did your REST services with Node, I would be forever in your debt. My email is in my profile if you get a chance.
- percept 16y agoPost it here! Or someplace we can access, if it's useful.
- pilif 16y agoif it wasn't a bit ugly (organically grown, just one endpoint), I'd direct you to the source code of the tempalias HTTP server. You can still have a look at it. As I said though, it's really ugly and I should really split it up into multiple files, factor out the common stuff and make the whole thing more clear. Still. Here goes: http://github.com/pilif/tempalias/blob/master/lib/tempalias_http.js http://github.com/pilif/tempalias/blob/master/lib/tempalias_... Lines 30 and following handle calls to /aliases (in my case, that's just a POST to /aliases to create an alias - later I'd add PUT to /aliases/<id> to update it and DELETE /aliases/<id> to delete it - assuming that a correct update key (part of the response to creation) has been created. As I said: Butt-ugly code. Don't do it like this - factor out common stuff, create smaller functions for the various parts of the needed setup.
- kls 16y agoThanks don't worry about the ugly. We all have pieces we are not proud off. I would just like to see the basic of what you did so I have a head start when I jump into Node. I can give you this, it is prettier than any code I have written in Node (if it is not apparent from my posts, I have not worked in Node).