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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:02:18+00:00 2026-05-31T16:02:18+00:00

I want to learn how to create a simple local server in ruby like

  • 0

I want to learn how to create a simple local server in ruby like maybe using webbrick. The main purpose here is that I am creating a web application and I want to do it myself without using any existing framework, so that I can learn the inner workings.

  • 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-31T16:02:19+00:00Added an answer on May 31, 2026 at 4:02 pm

    I think you just need to start doing it.

    My starting server:

    require 'socket'
    
    server = TCPServer.new '127.0.0.1', 8888 
    
    while session = server.accept
      session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
      if request = session.gets
        filename = request.gsub(/GET\ \//, '').gsub(/\ HTTP.*/, '').chomp
        filename = "index.html" if filename == ""
        session.print "You asked for a file called #{filename}"
      end
      session.close 
    end
    

    Of course, based on the filename you should try to fetch a file and send it to the client, maybe something like:

    displayfile = File.open(filename, 'r')
    content = displayfile.read()
    session.print content
    

    well if you want to learn, just start coding and trying different things, you may also look at the source code of some webservers on github. But, there is no point in posting here their code.

    I just showed you the really basics.

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

Sidebar

Related Questions

I really want to create a stunning-looking GUI desktop application that looks like, for
I'm trying to learn JPA and I want create a simple Java command line
I'm trying to use SharpDX to create a simple maze-like 2D program using DirectX.
For my college project, I want to create a simple application server in C
I want to create a simple smtp proxy using node.js, which receives mails and
There's a question that looks like this one here: Create my own classList object
I want to learn to program in a UNIX/Linux environment. I'll be using the
I want to learn windows API and PInvoke methods just like MesseageBeep in User32.dll.
I need to create a simple windows based GUI for a desktop application that
I want to learn how to create a rubygem with a generator etc. When

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.