Move REST API out to different file