modified apiUrl constant to figure out the location of /api at runtime