A Tutorial On HTTP Requests

get '/signup' do
if !logged_in?
erb :'/users/signup'
else
redirect to '/bbts'
end
end
post '/bbts' do
@bbt = current_user.bbts.build(name: params[:name])
@bbt.save
if @bbt.save
redirect to "/bbts/#{@bbt.id}"
else
redirect '/bbts/new'
end
end
patch '/bbts/:id' do
@bbt = current_user.bbts.find_by_id(params[:id])
if @bbt.update(bubble: params[:bubble], brand: params[:brand], sugar_amount: params[:sugar_amount], size: params[:size], temp: params[:temp])
redirect to "/bbts/#{@bbt.id}"
else
redirect to "/bbts/#{@bbt.id}/edit"
end
delete '/bbts/:id' do
@bbt = current_user.bbts.find(params[:id])
if @bbt
@bbt.destroy
redirect to '/bbts'
else
redirect '/bbts'
end
end

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

I Cleared the AWS Certified Cloud Practitioner (AWS CCP) in 5 days — Here’s How

How to choose the best open source fleet management software?

DownUnderCTF 2021 Writeups

What is the smallest apk file size for Flutter?

Custom Software Development: Why Businesses Should Build Their Own Solution?

Deploying serverless WordPress sites to Netlify for $13.16/yr

First time doing CLI ruby gem

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Travis Lee

Travis Lee

More from Medium

CS373 Spring 2022: Dillon Samra

How I Fell In ❤️ With Automation

Dockers — Build your first Image — Tutorial 2

Leveraging Kubernetes Network Policy for Securing your Applications

cluster_orchestration