Monocular is an MVC framework inspired by Rails. It includes a ControllerBase class which acts similar to a Rails Controller, and a Route class which similarly loads HTML views.
The router class enables the user to specify which controller and view to be used depending on the specified HTTP method and url.
All controllers in Monocular inherit from ControllerBase. ControllerBase gives them the following methods:
redirect_to(url)redirects the user to the specified urlrender(template_name)finds the correct file to be rendered, and passes the file along torender_contentrender_content(content, content-type)first checks whether a response has already been made, and then continues to set the response type and content of the response. Additionally, callssessionandflashsessioncreates a session cookie and writes appropriate data to the cookieflashcreates a flash cookie. A flash cookie can either be a flash or a flash.now. Flash persists for the current and next request, while flash.now only persists for the current request
- GitClone https://github.com/fnziman/Monocular
bundle installbundle exec ruby show.rb- Visit http://localhost:3000/shows
- Enter some of your favorite shows and how you would rate them