Guest User

Untitled

a guest
Jun 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. ## project/resources/blog.rb
  2. get '/blog' do
  3.  
  4. erb :index
  5.  
  6. end
  7.  
  8. get '/blog/:id' do |id|
  9.  
  10. halt 404 unless Integer(id) <= 0
  11.  
  12. end
  13.  
  14. post '/blog' do
  15.  
  16. # post new blog.
  17.  
  18. end
  19.  
  20. put '/blog/:id' do |id|
  21.  
  22. # update blog with :id.
  23.  
  24. end
  25.  
  26. delete '/blog/:id' do |id|
  27.  
  28. # delete blog with :id
  29.  
  30. end
  31.  
  32. ## project/base.rb
  33. require 'rubygems'
  34. require 'sinatra'
  35. require 'erb'
  36. require 'resources/blog'
  37. require 'dm-core'
  38.  
  39.  
  40. configure :production do
  41.  
  42. not_found do
  43.  
  44. erb :"exceptions/notfound", :layout => :"layouts/exception"
  45.  
  46. end
  47.  
  48. error do
  49.  
  50. erb :"exceptions/server_error", :layout => :"layouts/exception"
  51.  
  52. end
  53.  
  54. end
  55.  
  56. configure :development do
  57.  
  58. not_found do
  59.  
  60. erb :"exceptions/notfound", :layout => :"layouts/exception"
  61.  
  62. end
  63.  
  64. end
Add Comment
Please, Sign In to add comment