Skip to content

CWDG/sinatra-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinatra Page View Counter

It would probably be very helpful if you looked at the Sinatra documentation before attempting this project if you are unfamiliar with Sinatra.

Challenge

Make a simple Sinatra server that will increment a count whenever the site is visited. You can take this as far as you want, but it must:

  • Increment the count every time a person visits the page
  • Display the count somewhere

Setup

After cloning this repo, simply go into the directory where you cloned it and run:

$ bundle

Running the server

Run the server with:

$ ruby app.rb

Bonus points

Here are some ideas for making this cooler:

  • Add some content in a view! I'd recommend using ERB, since it's just HTML that will let you put Ruby in it.
  • Add more routes! Have them do different things.
  • Persist the count to a database (such as SQLite or PostgreSQL) or a key-value store (such as Redis).

About

A simple page view counter with Sinatra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages