Sha256: 2bef519ec8df1c5bfd9aabfad61cd9863fe39bcfeb0d92d65679744ca480b171
Contents?: true
Size: 910 Bytes
Versions: 12
Compression:
Stored size: 910 Bytes
Contents
require 'sinatra/base' module Coprl module Presenters module Demo # Echo's back post, delete and put # Used to demonstrate how the posts(updates), deletes and modifies actions work. class Echo < Sinatra::Base post('/_echo_') do content_type :json params[:echo] = JSON.parse(params[:echo]) if params[:echo] status(params[:status]) if params[:status] JSON.dump(params) end post('/_echo_snackbar_') do content_type :json JSON.dump(messages:{snackbar: [params[:snackbar_echo]]}) end delete('/_echo_') do content_type :json JSON.dump(params) end put('/_echo_') do content_type :json JSON.dump(params) end # start the server if ruby file executed directly run! if app_file == $0 end end end end
Version data entries
12 entries across 12 versions & 1 rubygems