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

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