Developers who add the trailing slash to the base URL for API calls are evil.
I can't be the only one who thinks that this is the only way.
❌ `${baseUrl}users
✅ `${baseUrl}/users`
I can't be the only one who thinks that this is the only way.
❌ `${baseUrl}users
✅ `${baseUrl}/users`
Comments
Isn’t there a URL normalisation function like for paths, to overcome this?
[
url.split("://")[0],
url
.split("://")[1]
.split("/")
.filter((val) => val !== "")
.join("/"),
].join("://")
I'm playing with the idea of publishing a new NPM package 🤣