jeremyevans / roda

Routing Tree Web Toolkit
http://roda.jeremyevans.net
MIT License
2.06k stars 140 forks source link

[Documentation / Question] Request for a FAQ for experienced sinatra users #288

Closed rubyFeedback closed 1 year ago

rubyFeedback commented 1 year ago

Heya Jeremy,

Hopefully you have a bit of time. I am aware you prefer to keep your projects clean so I feel almost bad adding this issue request. :)

However had, having noticed roda in the book "Polished Ruby" (which I have not finished readin; I, oddly enough read such books starting with the beginning but also with the last chapter, so I then finish in the middle, which is super-weird for many people but I kind of adopted it to avoid "road blocks" mentally when some parts seem a bit more tedious than others). So I came to roda.

I have had a few issues with sinatra. For simple things it works very well, but, for instance, I'd like to designate different public directories as-is. And that's not so trivial.

For instance my local images are spread all over the local file system, and I found it annoying that I could not simply add more public directories.

So my first question for that FAQ would be: is that possible in roda (yes/no), and if so, how to integrate multiple different public directories? Say, at /tmp/ and another one in my home directory, to keep this as a simple example.

My second question is: I use sinatra almost exclusively via the subclass approach. I avoid the toplevel DSL way. I'd like to know if I could use roda in a similar manner, so I'd love to see an example for this class-based approach in roda.

I prefer this mostly because I have a ton of modules that I integrate, and I found it easier to use the "traditional" ruby approach here, whereas with a DSL-first approach it confuses me, since I often don't know how or where to integrate classes.

Anyway. I'll stop this here. I may have a few more questions at a later time.

This is a bit more of a support question thing here, but on the other hand I think it is also useful for other people, in particular if they consider switching from sinatra (or also integrating roda; I have written a LOT of sinatra code so I will most likely not change straight away, but I'll explore roda and see whether I can make available some of my code with roda rather than sinatra, or in addition to that).

Anyway please feel free to close this at your leisure. I kind of noticed that you mentioned sinatra a few times, so this is perhaps the direct competitor for roda, and less so rails.

jeremyevans commented 1 year ago

Hopefully you have a bit of time. I am aware you prefer to keep your projects clean so I feel almost bad adding this issue request. :)

Discussions like this are fine, as long as you add them to the GitHub Discussions forum. GitHub Issues should be used only for bug reports.

I have had a few issues with sinatra. For simple things it works very well, but, for instance, I'd like to designate different public directories as-is. And that's not so trivial.

For instance my local images are spread all over the local file system, and I found it annoying that I could not simply add more public directories.

So my first question for that FAQ would be: is that possible in roda (yes/no), and if so, how to integrate multiple different public directories? Say, at /tmp/ and another one in my home directory, to keep this as a simple example.

Roda supports this, you want to use the multi_public plugin: https://roda.jeremyevans.net/rdoc/classes/Roda/RodaPlugins/MultiPublic.html

My second question is: I use sinatra almost exclusively via the subclass approach. I avoid the toplevel DSL way. I'd like to know if I could use roda in a similar manner, so I'd love to see an example for this class-based approach in roda.

Roda only supports the subclassing approach, it doesn't have a top-level DSL like Sinatra. Technically, you can use the Roda class itself, without subclassing, but that is not recommended.