jaetask / minimal-14kb-website

A modern website in <= 14Kb
1 stars 0 forks source link

router #1

Open leeoniya opened 8 years ago

leeoniya commented 8 years ago

@jaetask

hey! domvm author here.

btw, domvm has a tiny routing module :)

also check out http://projects.jga.me/routie/ which I was evaluating before going with my own.

another great minimal grid is http://leejordan.github.io/reflex/docs/

if you decide to go with domvm, feel free to ask for help, the docs are still sparse!

jaetask commented 8 years ago

Hey Leon, thanks for the input. I took a look at routie but it uses hash routing which I'd like to avoid. My plan is to provide standard express style routing and consumable urls.

I'm loving domvm, It's a great piece of code.

Nice one. Jae

leeoniya commented 8 years ago

domvm's router supports both hash and history api.

However, i discovered a serious limitation of using history-style routing when implementing ThreaditJS: the need for server-side routing support. You cannot just take your app/widget and plop it anywhere (other than domain root) as you can with hashes. The server must know to serve the same "front controller" regardless of actual uri in case you decide to F5-refresh some non-root route. With hash routing, you can run your SPA out of any sub-dir and it will just work without any server tweaking. I really have not found a compelling case to avoid hash routing. To me, /#/someroute vs /someroute is not worth the drawbacks. Perhaps there are SEO benefits, but that remains to be tested.

I'm in the process of writing a < 200kb impl of a gmail-style mobile webmail UI (including web/icon fonts)...also using Marked for composition. We should start a "tiny-webapps" org :)

jaetask commented 8 years ago

Yes, I have been thinking about this. I believe that there is an opportunity to solve this problem server side in a really elegant way.

I imagine that when you hit /someroute directly, via bookmark or F5 then it would deliver the routes content wrapped in the / controller and if you hit /someroute directly via ajax request then you would simply get the routes assets.

I might be over complicating the app by doing that, and looking at my most used apps gmail and rememberthemilk.com, both of them use the hashing method.

Can I ask why you chose to write your own when routie was available and comes in at 800 bytes?

p.s. TinyWebappsRUS are the future :) I deleted over 80% of the code on my last project and it made a huge difference on 2G/3G. I think people forget that not everyone/everywhere has fast connections. You app sounds cool, is it open source or a private build?

leeoniya commented 8 years ago

Can I ask why you chose to write your own when routie was available and comes in at 800 bytes?

Routie is a bit too simple, kinda like domchanger :). I needed href generation from params, i needed querystring support, hash-in-hash support, onenter and onexit callbacks, uniform History api support, etc. domvm's router does all this in 2100 bytes (min). A quick intro: https://github.com/leeoniya/domvm#route-module

Also, the API is more uniform with the rest of domvm without being tightly coupled.

You app sounds cool, is it open source or a private build?

I'm writing it for a blog post to introduce domvm. It will be open source. If you want to help, you can. The backend serves JSON from an sqlite database of Hillary Clinton's released emails, since i didn't want to use my own private messages :)

jaetask commented 8 years ago

Hi, You should also keep an eye on this project

https://github.com/jaetask/gym-guide

Its open source and I am going to be using domvm :)

leeoniya commented 8 years ago

ok, thanks. i'll watch it and comment if i see any non-idiomatic hacks. it'll help me with docs and/or guides/tutorials.

gangaanonymous commented 7 years ago

Connection problem arises. How can i connect to my router by WAN from another city ? I have a router at my hone and want to connect it from my workplace computer