added json middleware
added sample implementation of api