14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sinatra でコントローラ分割的なことをする時の Tips

Posted at

Sinatra 書いてると予想外にルーティングが多くなってきてダルいみたいな局面の時用。本来は設計時にちゃんと Rails とか使っとくのが正しい

base.rb
class Base < Sinatra::Base
  use Front
  use API
end
front.rb
class Front < Sinatra::Base
  get '/'
    slim :index
  end
end
api.rb
class API < Sinatra::Base
  get '/api'
    not_found
  end
end
14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?