Open U54 opened 8 years ago
Hi! Sorry to just get to this... Been a little busy with work. You could definitely get this to work on a different domain but it would require setting up another server to handle requests at that domain. The way it works is that you assign a unique ID to a link and then add that as a parameter at the end of the route:
http://dashboard.example.com/:id
The router takes the unique id and finds the url that is associated with it. So for instance, if we had a url document in the database like this:
{
path: 'random-string',
longUrl: 'https://google.com'
}
When someone visited http://dashboard.example.com/random-string
the app would route them to https://google.com
instead.
In order for this to work with a different domain you'd need to direct traffic from another server to your main app (or wherever the url shortener router is). You could do this with nginx or some other server. Shouldn't be super difficult to setup.
Let's say you have the url shortener on the dashboard app. If you are familiar with nginx you could setup a server on digital ocean or wherever and proxy pass all traffic to https://short.er
to https://dashboard.example.com
. Hope that helps! Let me know if you have any questions.
Hi, this package looks super useful and I've been searching for something similar for a project I'm working on. I have a question though, is there a way that I would be able to use a different domain name for the shortened URLs? I have two domains, one for my app, and then one which is smaller and I'm hoping to use for shortened urls.
Example: A user signs into their account at
dashboard.example.com
, in their dashboard there is the ability to create a shortened URL, so they paste their long URL into the form and click "Shorten" the output would then be a different domain such asshort.er/123
instead ofdashboard.example.com/123
orexample.com/123
I wonder how difficult it would be to integrate something like this? If you've made anything like this work I'd absolutely love to hear any info you can share.