refactored js; resolved hoisting issues
refactor js into seperate files
move caching logic of posts array in controller
remove console.log
Merge pull request #50 from anirudh-eka/caching-autoupdate

Refactor js into file structure