Serve with sinatra api

19 views
Skip to first unread message

Jose Castaneyra

unread,
Jan 29, 2013, 2:57:52 PM1/29/13
to serve...@googlegroups.com
Hi all,

serve is a very cool gem, and right now I am exploring it for two projects, one for static page, in this case is awesome, but I have other project where I need to have a API running with sinatra, but at the same time I would like to work the rapid prototyping scheme, could I have running sinatra within config.ru? does anybody have done this without having two different ports?

I already tried this, but when I have a URL that is not in my sinatra routes I get "Sinatra doesn’t know this ditty".

Thanks in advance!!

Jose Castaneyra

unread,
Jan 29, 2013, 3:18:02 PM1/29/13
to serve...@googlegroups.com
Ok, for the record, I could do it,

I set in config.ru the following:

require 'sinatra'
require './app'

run Rack::Cascade.new([
    Serve::RackAdapter.new(root + '/views'),
    Rack::Directory.new(root + '/public'),
    Sinatra::Application
  ])

and now I have running also my Sinatra app.

Thanks!! 

John Long

unread,
Jan 29, 2013, 3:18:51 PM1/29/13
to serve...@googlegroups.com
Yup! It's just a matter of being familiar with how Rack::Cascade works.

--John

--
--
Serve Users Group
Mailing List: http://groups.google.com/group/serve-users/
Project: http://github.com/jlong/serve/
 
---
You received this message because you are subscribed to the Google Groups "Serve Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to serve-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages