Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6197875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:53:57+00:00 2026-05-24T03:53:57+00:00

I found nothing about how I can mix-in routes from another module, like this:

  • 0

I found nothing about how I can mix-in routes from another module, like this:

module otherRoutes
  get "/route1" do

  end
end    

class Server < Sinatra::Base
  include otherRoutes

  get "/" do
    #do something
  end
end

Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:53:58+00:00Added an answer on May 24, 2026 at 3:53 am

    You don’t do include with Sinatra. You use extensions together with register.

    I.e. build your module in a separate file:

    require 'sinatra/base'
    
    module Sinatra
      module OtherRoutes
        def self.registered(app)
          app.get "/route1" do
            ...
          end
        end
      end
      register OtherRoutes # for non modular apps, just include this file and it will register
    end
    

    And then register:

    class Server < Sinatra::Base
      register Sinatra::OtherRoutes
      ...
    end
    

    It’s not really clear from the docs that this is the way to go for non-basic Sinatra apps. Hope it helps others.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm at wits end now, I have googled this to death and found nothing.
I'm a beginner in JQuery (I know nothing about this framework). I recently found
I have searched in google about mongoDB and iOS but found nothing. Can I
So this is IT more than programming but Google found nothing, and you guys
I found a posting on the MySQL forums from 2005 , but nothing more
Found this: Sub SurroundWithAppendTag() DTE.ActiveDocument.Selection.Text = .Append( + DTE.ActiveDocument.Selection.Text + ) End Sub But
found this regex: insert every 10 characters: $text = preg_replace(|(.{10})|u, \${1}. , $text); can
Sorry for the probably stupid question. Since I found nothing about it on the
this is a hard question. I've found nothing interesting over the web. I'm developing
In a book on Core Java, I found this excerpt : Think about the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.