core/apiRouter: Split out API routes function for testing