Sinatra does not follow the MVC architecture completely; it is a VC framework. It was mentioned earlier that the model is the data part of the application, view is the user interface, and controller is the interconnection. Now, let's find these parts in the preceding code:
1 require 'sinatra' 2 3 get '/' do 4 return 'Hello World!' 5 end
Here, line 1 requires just the gem. Lines 3 to 5 define a code-block that is invoked on receiving a
get request and returns a value. So here, this code-block forms the controller. It controls what to return when a request is received.
The view is the page rendered by the browser. We do not have a separate view here but line 4 defines the contents of the view.