Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.02 KB

README.md

File metadata and controls

32 lines (21 loc) · 1.02 KB

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).