DEV Community

loading...

The beauty of Sinatra, REST, and CRUD

Jonathan Cohen
I'm a guy that is used to working with my hands in the labor workforce. Last year I decided to start working with my hands in tech.
・2 min read

The second phase of being a Flatiron student has passed and I find myself growing more and more comfortable with code. The second block of our studies led up to the use of a “light weight framework” called Sinatra. The main page of documentaiton describes sinatra as a domain specific language that allows for web application creation “with minimal effort”. While the effort on my end was far from minimal, I still found the basics of this framework understandable and much easier to follow than I would have orignially thought any of this would have been on day 1.

My sinatra project was a video game organizer. A web application allowing a User to sign up, log in, keep track of the games(through the use of an ActiveRecord Database) that they own and log out. This web application is based on the use of RESTful routing, a convention that allows developers to create usable routes that can Create objects, Read objects, Update objects and even Destroy those Objects. Using HTTP methods (GET, POST, PATCH, DELETE) and CRUD actions (Create, Read, Update, Destroy) theres a flow thats created that you may have never even realized, although you may use it everyday.

Take a facebook status/post for example, you can create a post as a logged in user, that post can be read by you and other users( due to the POST HTTP method). If a mistake is made you could make the appropriate changes and update that existing post thanks to the patch method and even delete your post if you decide that what you posted as an update may have been an “in the heat of the moment” action. Definitely something Im sure we all can relate to.

This project really opened my eyes to the possibilities that I’ll have If I continue to give this venture my all and my best. I really enjoyed this project and am looking forward to learning even more in this world of coding.

Discussion (0)