In this project, I created a simple blog application using the Ruby programming language and the Sinatra web framework. The application allows users to view existing blog posts, create new posts, and read individual posts
I utilized the Ruby programming language to build the core logic and functionality of the blog application. Ruby is a dynamic, object-oriented language known for its simplicity and readability.
I employed the Sinatra web framework, to handle the web server functionality and routing in the application. Sinatra simplifies the process of building web applications by providing a DSL (Domain-Specific Language) for defining routes and handling HTTP requests. HTML and ERB: I used HTML (Hypertext Markup Language) for structuring the web pages and ERB (Embedded Ruby) as the template engine for embedding Ruby code within the HTML templates. ERB allows dynamic generation of HTML content based on the data and logic in my Ruby application.
I created the project structure, including the main Ruby file (app.rb) and the views directory to store the HTML templates.
I defined routes for the home page, creating a new post, and displaying individual posts. These routes map to specific URL paths and define the corresponding actions to be executed.
I included sample data for blog posts within the app.rb file to simulate a database or external data source. This data is used to populate the blog posts in the application.
I used the ERB template engine to render the HTML templates and pass dynamic data from the Ruby application to the templates. This allows us to generate dynamic web pages based on the blog post data.
I implemented logic to handle HTTP requests such as GET and POST requests. For example, creating a new post involves processing form data and redirecting the user to the home page.
I utilized the WEBrick web server to run the application locally during development. The server listens on a specific port and handles incoming HTTP requests.
I showcased basic proficiency in the Ruby programming language by implementing the core logic of the blog application, managing data, and handling HTTP requests.
I demonstrated our understanding of web development concepts by utilizing the Sinatra web framework to define routes, handle HTTP requests, and render templates.
I leveraged HTML and the ERB template engine to create dynamic web pages and seamlessly integrate Ruby code within the HTML templates.
I organized the project by creating the necessary files and directories. Additionally, I committed the code changes using version control (Git) to track the project's history.
Overall, this project allowed me to practice web development fundamentals using Ruby and Sinatra. I gained experience in setting up a basic web server, handling routes and HTTP requests, and rendering dynamic content. These skills can be further expanded upon to develop more advanced web applications in the future.