move routes into lib, fix server to use new path