lundi 3 octobre 2016

Get request not working as expected (Sinatra)

I can't seem to understand why my code below is not working as expected. I am currently following a tutorial on Sinatra (Singing with Sinatra). The get request on root ("/") works fine but the other get requests goes to the "Sinatra doesn’t know this ditty" page. Please can someone explain to me what I'm doing wrong (or point me in the right direction).

Code:

require 'rubygems'
require 'sinatra'

#Get Request on Root ("/") <-- Works fine
get '/' do
   'Hello Sinatra World'
end

#Get Request for the about page ("/about") <-- Not working
get '/about' do
   'A little about me.'
end

#Get Request on parsing parameter name ("/hello/:name") <-- Not working
get '/hello/:name' do
   "Hello #{params[:name]}, welcome to Sinatra world"
end

NB: The above code is implemented on a Windows machine.




Aucun commentaire:

Enregistrer un commentaire