Use testify package for unit testing
Add unit tests for RESTful API

Also restructure the code and add some interface to make
application more testable.