refactor app to be lightweight and use rails-api gem