Move network request logic to an npm module, fix broken routes.