MongoDB class

Hey guys! Since we started with the MongoDB course. Just saw the first video, which has some writing code in it, so I thought, I will write some, since ❤ ruby ❤
The link for the class video is – link. You can go ahead have a look and see, what it does. I just wrote a similar code which lets us do the same thing in ruby. Using sinatra( bottle is being used with python in the video)

# Steps
# 1. Install the gem sinatra
gem install sinatra
# you you skip rdoc and ri using
# gem install sinatra --no-rdoc --no-ri
view raw install_gem.sh hosted with ❤ by GitHub
# hello_world.rb
# This will manage routes and display the content.
# I am sure, you did watch the video before checking this out.
require "sinatra"
set :bind, '127.0.0.1'
set :port, '8080'
get '/hello/:name' do
"Hello #{params[:name]}!"
end
view raw hello_world.rb hosted with ❤ by GitHub
# just simply run the ruby file that we created.
ruby hello_world.rb
view raw run_server.sh hosted with ❤ by GitHub

Thats it folks, we are done. Head over to http”//127.0.0.1:8080/hello/world and see for yourself.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.