updated to handle both a separate API and front (frontend) server