Show HN: Routerless
163.172.181.149
163.172.181.149
Why the word "routerless" is in the title is a mystery to me.
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
It's nice but I'm still not sure when to use it and why you made it.
Maybe you could add your personal use and motivation to it? Otherwise it's a clever library.
I have a couple of questions though:
When I have done this in the past, I have used the url fragment to store the state, i.e.: https://sheep.horse/tagcloud.html#computing . This works even with static sites because the browser doesn't send the fragment (everything past the # symbol) to the server.
By encoding state in the path of the URL, you require server support. I guess the flip side of that is that your site can continue to work without js support.
I notice that your demo and docs don't mention anything about manipulating the browser's history to allow the user to move to previous states using the back button. That can be a pretty useful thing to provide.
Maintaining state in the path, query parameters, or fragment are all techniques that can work, but each comes with disadvantages.
I wonder if anyone has been mad enough to maintain state in subdomains:
Please explain me the part about back button on example.
This is because your write() function uses relaceState() to modify the current url. If you used pushState (like your go() function does) then the browser would correctly maintain history.
Now, maintaining a history of the current state is not always the best thing to do. For instance, on your other demo page, the one where you type your name, you probably don't want to push a history item for each key press.
I think you should consider offering the option to push local history so that an app developer can decide if it makes sense.
It manages for you what you want to be in a history. Imagine example with an input which writes on each keyup to the history and going back letter by letter.
So when you click on a "link" it goes to the history. If you play with params on a single view it replaces.
What do you think?
@madmaniak, add some examples, please :-)
Step 1: Attach pro-router
Step 2: R.init(root: 'helloworld')
Step 3:
R.write('foo', 'bar')
# url changes from '/' to '/helloworld/foo/bar'
R.param('foo') # => 'bar'
Please ask me any use case you'd like to solve. I'll try to explain more.
If you can ignore the layout you'll find neat art project for frontend routing :)
I tried scrolling to the left thinking there was more content, but that was it. It looked better on Chrome when I set the size to be 80%.
If this is 67 lines of code with zero dependencies, why do I need it as a dependency?
Regarding CDN implementation, why would anyone add an HTTP request to the page for 900 bytes?
2. If you want to check it out quickly with minimal effort, play in your browser js console - it's there.