JS: send http request to a specific port

I have a MERN website that uses port 80 for the front-end and port 4000 for the back-end API. In MERN tutorials, they put axios.post('localhost:4000/login'...) to communicate with the backend API. But this won’t work in production if I have a domain like example.com. Is there a way to use relative URLs to specify a port, like axios.post(':4000/login')?