Set root to index of posts
refactored out common parts to shared folder
Add rspec for testing