Please help me simplify my url-shortener code

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?

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

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

1 Like