Hello everyone!
I just finished my third project, The URL shortener, and I want some feedback. Thx in advance.
API link: https://urlzika.herokuapp.com/
Github: https://github.com/Armandilho/URL-Shortener-Microservice
Hello everyone!
I just finished my third project, The URL shortener, and I want some feedback. Thx in advance.
API link: https://urlzika.herokuapp.com/
Github: https://github.com/Armandilho/URL-Shortener-Microservice
Well done!
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
Now, that’s a regular expression! lol
Speaking of RegExp… When the request has an invalid URL format, the response is this: {"error":"Invalid Url regex Error"}
. I would change that to a more friendly message, like just “Invalid URL”.
Anyways… Congrats!
Ty for the feedback. haha you are right I didn’t think too much about that error message I will fix that.