Hacker News new | ask | show | jobs
by bestie 4476 days ago
Route directly how? Write my own HTTP layer? It's so easy to take advantage of Rails' routing and view rendering.
1 comments

Route directly how?

Well, instead of fighting rails, you could just use the lower level stuff it is based on which does the bits you want:

Routing - https://github.com/rack/rack

Templates - http://www.ruby-doc.org/stdlib-2.1.1/libdoc/erb/rdoc/ERB.htm...

Rails adds quite a lot of overhead and complexity, not to mention memory usage, so if you're going to bypass most of it, it might be better to start with something more bare-bones?

I agree with that, bringing rails in is like bringing a chainsaw to cut a twig sometimes...

The point here is not to look at the devise/router serving http but the porting of the data & business logic to an adaptable, multi-purposed api that is not tied down to the infrastructure in any way.

I've used this approach within a Sinatra driven app, CTO said i need to use Rails now for some other thing, a few hours to make the switch, not rewrite the whole thing.