article.to_json end ! put "/articles/:id" do article = Article[params[:id]] return status(404) unless article article.update(params[:article]) article.to_json end ! delete "/articles/:id" do article = Article[params[:id]] return status 404 unless article article.delete status 204 end Sinatra
! on article.nil? do res.status = 404 end ! get do json(article) end ! put do article.update(req[:article]) json(article) end ! delete do article.delete res.status = 204 end end end Tynn