DEV Community

Discussion on: Allun.ga - Open Source URL shortner

Collapse
 
testdotcom profile image
Alessio

Well we choose JS (specifically React) because

  1. it's easy to pick and use
  2. this webapp is computationally inexpensive, almost every client can run it

As the back button history, I don't see the issue. After you expand an URL where should you "go back to"? (or maybe you mean something else?)

Best regards :)

Collapse
 
nektro profile image
Meghan (she/her)

Consider a user on twitter interacting with a tweet that has a link from your site. Clicking on this link will result in an HTTP 200 response for the page which will then redirect to the next link in the chain, which will hopefully also return a 200.

Where as, if this was a server side app you would not return a 200 but a 301 making it so that when the user is on site B and hits “back then they would go back to twitter and not your app and get caught in an infinite loop.

Thread Thread
 
testdotcom profile image
Alessio

Honestly, I did not think about it. But, if I recall correctly, with React-Router you can manage the browser history.
Do you have any tip?

PS: tried it on twitter/gmail and the default behaviour is to open my link on a new tab

Thread Thread
 
nektro profile image
Meghan (she/her)

you are correct and it does in fact actually work, that's my bad. in that case, making this server side would only increase load time, but cool project overall :)

Thread Thread
 
testdotcom profile image
Alessio

Glad to know it works well! And thanks for your interest