Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Rack for API #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

use Rack for API #142

wants to merge 2 commits into from

Conversation

mulderp
Copy link
Contributor

@mulderp mulderp commented Jul 17, 2013

Extracting the API into a Rack middleware might be interesting to combine Lamernews with other Rack applications, and/or to build a custom UI variation.

Glad to hear your feedback if this is interesting for you.

The Lamernews API would then be accessible from Rack with:

use Lamernews::API

@fcambus
Copy link
Collaborator

fcambus commented Aug 11, 2013

While it could be interesting, this breaks the ability to simply install the few required gems manually and launch Lamer News by simply invoking "ruby app.rb", which makes it really easy even for Ruby neophytes to get involved.

Maybe putting the API code in a separate file (could be "api.rb") and simply requiring it from the "app.rb" file could be a good compromise?

@mulderp
Copy link
Contributor Author

mulderp commented Aug 12, 2013

Interesting. I will check.

@fcambus
Copy link
Collaborator

fcambus commented Aug 12, 2013

I think this is a great idea though, and it should probably be explored!

Also, it could makes things easier to create Lamer News implementations in other languages. As far as I know, there is only one port currently, written in Perl : https://github.com/beanz/camelnews

@mulderp
Copy link
Contributor Author

mulderp commented Aug 14, 2013

When using middlewares, it might make sense to use a middleware to connect to Redis, since that DB layer will be used both in the UI, and in the API part. I updated the PR, it's very experiment. However, both work:

   ruby app.rb
   rackup

@huydx
Copy link

huydx commented Sep 18, 2013

hope @antirez will merge this pull request soon. I want to have a clean way to integrate lamernews to my rails app

@mulderp
Copy link
Contributor Author

mulderp commented Sep 18, 2013

Actually, I guess the PR is rather to be closed, since Lamernews and Rails
are a bit off different architectures. I would be interested though to hear
if this works in principle. I also saw that @mitchellh supports Rack based
application architectures:
euruko2012/call-for-proposals#83

On Wed, Sep 18, 2013 at 5:41 PM, huydx [email protected] wrote:

hope @antirez https://github.com/antirez will merge this pull request
soon. I want to have a clean way to integrate lamernews to my rails app


Reply to this email directly or view it on GitHubhttps://github.com//pull/142#issuecomment-24674757
.

@mitchellh
Copy link

@mulderp Vagrant is completely based on "Rack-style" middleware, see here: https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/action.rb#L52-L78

@mulderp
Copy link
Contributor Author

mulderp commented Sep 18, 2013

great! thanks for the pointer!

On Wed, Sep 18, 2013 at 6:11 PM, Mitchell Hashimoto <
[email protected]> wrote:

@mulderp https://github.com/mulderp Vagrant is completely based on
"Rack-style" middleware, see here:
https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/action.rb#L52-L78


Reply to this email directly or view it on GitHubhttps://github.com//pull/142#issuecomment-24677378
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants