Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple single ruby file web app
    primarykey
    data
    text
    <p>Okay this seems like a real noob question.</p> <p>I currently have a simple html and javascript news reader running on my MAMP server. You can see it on <a href="https://github.com/laverboy/message-mobile" rel="nofollow">Github</a>. Everything runs client side except for fetching and caching the feeds which is done by a really small php file. I have an ajax call which requests the news feed from the php script by passing some parameters to it.</p> <p>I have of late been learning Ruby and have started to redo this simple php script in Ruby. The problem I have is that I can't just request the ruby script via ajax with parameters like I would do with php.</p> <p>So what would be the simplest steps to take to be able to do this? </p> <p>I feel like a full blown framework, even as small as Sinatra, would be overkill. So any help would be much appreciated. Am I completely thinking about this the wrong way round? Thanks.</p> <p><strong>Update</strong></p> <p>I went the Ruby CGI way in the end. Here's what I did.</p> <p>In the folder I had my script I added a .htaccess file with the following to make apache execute the .rb file.</p> <pre><code>AddHandler cgi-script .rb Options +ExecCGI </code></pre> <p>Then I started my ruby file off like this.</p> <pre><code>#!/usr/bin/ruby require 'cgi' cgi = CGI.new('html4') cgi.out { cgi.html { "Hello World" #started content here } } </code></pre> <p>I then made sure the file was executable. <code>chmod 774</code>. </p> <p>Thanks for all your help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload