Skip to content

LukeAims/ruby_webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project Overview; simple Blog Application

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

Languages and Techniques Used

Ruby

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.

Sinatra

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.

Project Steps

Setting up the Project

I created the project structure, including the main Ruby file (app.rb) and the views directory to store the HTML templates.

Defining Routes

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.

Sample Data

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.

Rendering Templates

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.

Handling HTTP Requests

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.

Running the Web Server

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.

Skills Demonstrated

Ruby Programming

I showcased basic proficiency in the Ruby programming language by implementing the core logic of the blog application, managing data, and handling HTTP requests.

Web Development with Sinatra

I demonstrated our understanding of web development concepts by utilizing the Sinatra web framework to define routes, handle HTTP requests, and render templates.

HTML and ERB Templating

I leveraged HTML and the ERB template engine to create dynamic web pages and seamlessly integrate Ruby code within the HTML templates.

Project Structuring and Version Control

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.

About

A simple web-server and basic test blog

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published