URL-shortening-API-landing-page

Solution retrospective
All the feed back are welcomed thanks in advance.
What challenges did you encounter, and how did you overcome them?The API refused to work I need help APIS mine is not working I will be happy when my humble request is accepted. submitting react native project also was a challenge for me.
What specific areas of your project would you like help with?APIS area
Please log in to post a comment
Log in with GitHubCommunity feedback
- P@ttsoares
This is how I did it some time ago:
var urlNoProtocol = url.replace(/^https?\:\/\//i, ""); const response = await fetch(`https://api.shrtco.de/v2/shorten?url=${urlNoProtocol}`); const data = await response.json();
The 'url' variable has what the user wrote in the form.
What do that Regular Expression ?
- Removes the "http://" or "https://" part from the URL, in a case-insensitive manner.
- It does this by matching the "http://" or "https://" at the beginning of the string (^).
- The "?" after the "s" makes the match for "s" optional, so both "http" and "https" are matched.
- The "i" flag at the end makes the match case-insensitive.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord