How to run a simple ruby script in any web server (Apache or Mongrel or any thing else)

前端 未结 7 872
半阙折子戏
半阙折子戏 2021-02-05 06:20

It seems very funny to me that when I search something related ruby, all ruby on rails related results popped up. So nobody using raw ruby anymore?

However, I am new to

7条回答
  •  无人共我
    2021-02-05 07:02

    #!/usr/bin/env ruby  //shebang line to indicate path to ruby.
    require 'cgi'       //cgi file to create a simple cgi object.
    cgi = CGI.new      //instantiating a cgi object. 
    puts cgi.header   //thats telling the server about the type(html).
    puts "hello"      // thats the output on the browser.
    

提交回复
热议问题