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 6774909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:50:38+00:00 2026-05-26T15:50:38+00:00

all, i need to do this as the following require ‘sinatra’ require ‘app_env’ get

  • 0

all, i need to do this as the following

require 'sinatra'
require 'app_env'

get '/home' do
  'home page'
end

get '/about' do
  'about page'
end

get '/docs' do
  'docs page'
end

I not sure which route will be the root route, maybe the home, about, or docs page. So, i have to set the root page in a file app_env.rb with a line like this route_map '/home' => '/' .
Now, how do i write the method/function route_map

or anything else to implement my requirement for mapping the route dynamically.

EDIT : MY ANSWER

HOMEPAGE = '/home_page'
get '/' do
    status, headers, body = call! env.merge("PATH_INFO" => HOMEPAGE)
end
  • 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-26T15:50:39+00:00Added an answer on May 26, 2026 at 3:50 pm

    If you are looking to reroute requests for ‘/’ to ‘/home’ then all that you need to do is:

    get '/'
      redirect '/home'
    end
    

    If you do not want to redirect you could do this:

    get '/foo' do
        status, headers, body = call env.merge("PATH_INFO" => '/bar')
        [status, headers, body.map(&:upcase)]
    end
    
    get '/bar' do
        "bar"
    end
    

    See this for details.

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

Sidebar

Related Questions

I've been trying to get this code to work for hours! All I need
All I need this for is strcpy(). I want to see whether the first
I've got a reasonably simple query (this time) that I need ALL the results
I need to uncompress all the files in a directory and for this I
I need to generate Entities/Object from selected tables - not all. Is this possible
First of all I'm not sure this is even possible, however I need to
Is this combination possible at all? If yes, will I still need to buy
I've managed to mostly ignore all this multi-byte character stuff, but now I need
Ok so if I have this pattern: ab&bc&cd&de&ef And I need to replace all
First of all, this may need to be moved to superuser. I couldn't decide

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.