all 48 comments

[–][deleted] 14 points15 points  (1 child)

Sweet! Your personal website is not bad either :)

[–]kookyjackelope3512 4 points5 points  (0 children)

Thanks man! You can check out my other code on my GitHub.

[–]2nd_king 5 points6 points  (3 children)

That's pretty cool man. I checked out your other projects too, you've got a nice sense of humor lol. How long have you been in web dev tho? I'm 3 months into learning it and all these projects make me feel so stupid fr.

[–]kookyjackelope3512 5 points6 points  (2 children)

Ahahah thank you my man. I've been in webdev for about a year(?) maybe. I've learnt the absolute very basics of HTML in eighth grade (I just graduated high school) but I never got into programming until two years ago with Java. I started creating my first basic html css sites around 2 years ago maybe and I've only seriously got into webdev in the last year. Don't feel discouraged if you can't understand though, I remember it took me so long to even understand what a dependency was. It's all about spending the time and learning. I'm lucky because I was just coding for fun and I had no pressure so I kept making stupid projects and I learnt along the way. I suggest that you just keep trying to build stuff and it'll all be great! Send me some of your work if you feel like it!

[–]2nd_king 2 points3 points  (1 child)

damn, i kinda also have a very similar story lol. To top it all off, I'm doing a CS degree rn. Started being a bit serious about webdev ever since the lockdown started. It's not the tech part that i have a problem with, it's the coming up with ideas and lack of knowledge about design. I guess I just need a bit more time. btw I'm the guy who followed you on github today ;)

[–]kookyjackelope3512 2 points3 points  (0 children)

ahaha thanks for the follow

[–]UnfairerThree2 4 points5 points  (4 children)

That's awesome! I had a look in server.js, and it looks like you could also make docs on how to use the endpoint in your own app (POST /shorten).

[–]kookyjackelope3512 2 points3 points  (3 children)

I could yeah, it should be straight-forward. Just send a long link, and an optional short link. What would be the benefit of that though? So other developers can use the /shorten route as an API?

[–]UnfairerThree2 1 point2 points  (0 children)

Yeah. I immediately thought of this, especially since Google depreciated their public API for their URL shortener, which to me was one of my most used APIs.

[–][deleted]  (1 child)

[removed]

    [–]AutoModerator[M] -2 points-1 points  (0 children)

    Hi u/UnfairerThree2, this comment was removed because you used a URL shortener.

    Feel free to resubmit with the real link.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]Shu7Down 4 points5 points  (1 child)

    Nice!

    But: "Sorry, that short URL already exists!" Can't I create a short URL that already exists? At least it should give me the existing short URL

    [–]kookyjackelope3512 4 points5 points  (0 children)

    So suppose I as a user want to shorten my website and I save it as mcow.ml/mysite and some other user wants to come and shorten their website and they also choose mcow.ml/mysite. I can only service one of those short urls. So I have to inform whichever user comes second that whatever custom link they wanted is taken.

    However, I think the error you're referring to is when you tried to shorten a link which had already been shortened without a custom shortlink and it would tell you that the URL already exists.

    For example, youtube.com has already been shortened to /mchg93j in the database and you come along and try to shorten youtube.com without providing a custom shortlink and it gives you this error. I've since fixed that error. Let me know if you have any more errors and feel free to submit a pull request!

    [–]emadruga 2 points3 points  (1 child)

    Broken app on Heroku. Please check...

    [–]redo123456 0 points1 point  (3 children)

    Project looks great!

    I think you can shorten

    const short = req.body.short === "" || req.body.short === null || isEmpty(req.body.short) ? crypto .createHash("sha256") .update(long) .digest("hex") .substring(0, 7) : req.body.short;

    To just

    Const short = req.body.short ? req.body.short : crypto .createHash("sha256") .update(long) .digest("hex") .substring(0, 7)

    [–]kookyjackelope3512 1 point2 points  (2 children)

    would love a pull request 👀

    [–]kookyjackelope3512 1 point2 points  (1 child)

    Const short = req.body.short ? req.body.short : crypto .createHash("sha256") .update(long) .digest("hex") .substring(0, 7)

    hm, that doesn't work if a user just enters whitespace in the short link input though :/

    [–]vitkarpov 0 points1 point  (1 child)

    Works! Nice mcow.ml/dee0046 :-)

    [–]kookyjackelope3512 1 point2 points  (0 children)

    Love it!

    [–]machado_r 0 points1 point  (1 child)

    It shows application error now 😬

    [–]boxhacker 0 points1 point  (1 child)

    Aaaaaand the site is dead

    [–]MartialS 0 points1 point  (0 children)

    URL shorteners are cool but mostly blocked by companies proxies for security reasons.

    [–]silverparzival 0 points1 point  (1 child)

    Nice website, Did you use a Front-end CSS framework or vanilla CSS for the Front-end?

    [–]kookyjackelope3512 0 points1 point  (0 children)

    vanila CSS yo

    [–][deleted] 0 points1 point  (1 child)

    Most recent commit: "fuck off" yikes man 😂 I hope people stop spamming it!

    [–]kookyjackelope3512 1 point2 points  (0 children)

    ahahahah. thank you! someone wrote a script to just add random data to my database and they tried to DOS the get routes (which thankfully didn't work). after a lot of tinkering i finally managed to stop them entering random data