Sha256: eb44870cb72f0421c45f03e87df500cbbc46bff8293cc05bad5babfa63d559cb

Contents?: true

Size: 348 Bytes

Versions: 3

Compression:

Stored size: 348 Bytes

Contents

require 'thin'
require 'sinatra/base'
require 'json'

class MalmWeb < Sinatra::Base
  get "/" do
    "Hello World\n"
  end
  
  get "/messages" do
    content_type :json
    settings.message_db.find_all.to_json
  end
  
  get "/messages/:id" do
    content_type :json
    id = Integer(params[:id])
    settings.message_db.find(id).to_json
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
malm-0.0.4 lib/malm_web.rb
malm-0.0.3 lib/malm_web.rb
malm-0.0.2 lib/malm_web.rb