Please help me simplify my url-shortener code

Please help me simplify my url-shortener code
0

#1

I’m curious if there is a way to simplify the url checking for this project - right now I have to handle http and https links separately because app.get will respond differently to them. It’s a little clunky. Is there a way to combine the app.get requests so that both new/http:// and new/https:// urls can be handled by the same function?

https://floating-headland-24202.herokuapp.com/

Any other feedback on the app is also appreciated. Thanks.


#2

I don’t know about “simplify”, but you could organize this using required modules and Express’s router.