5 changed files with 80 additions and 29 deletions
			
			
		@ -1 +1 @@ | 
				
			|||||
["home","installation","usage","abstract"] | 
					["home","installation","usage","choosing-router-style"] | 
				
			||||
@ -1,2 +0,0 @@ | 
				
			|||||
tag view-abstract | 
					 | 
				
			||||
	<self> 11 | 
					 | 
				
			||||
@ -0,0 +1,52 @@ | 
				
			|||||
 | 
					tag view-choosing-router-style | 
				
			||||
 | 
						<self> | 
				
			||||
 | 
							"Few words about different use cases of different routing styles." | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							"In fact all of these can be used together in one application." | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							<content-list> | 
				
			||||
 | 
								"Routing styles" | 
				
			||||
 | 
								<li> | 
				
			||||
 | 
									<li @click.stop=Goto($url)> 'URL based' | 
				
			||||
 | 
									<li @click.stop=Goto($hash)> 'Hash based' | 
				
			||||
 | 
									<li @click.stop=Goto($both)> 'URL + Hash' | 
				
			||||
 | 
									<li @click.stop=Goto($var)> 'URL variables based' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
							<h2$url.gradient> "URL based router" | 
				
			||||
 | 
							<imba-code.no-code url="example.com/with/normal/url"> | 
				
			||||
 | 
							"This is standard way of routing and requires that you have a router on the server side also. | 
				
			||||
 | 
							Browser while approaching application will always send full URL to the server. | 
				
			||||
 | 
							This is useful when you want to do SSR (server side rendering). SSR is needed for bots only (like Google, Facebook etc.). | 
				
			||||
 | 
							So use it for these parts of application which are public and you want them to be crawlable/readable for bots." | 
				
			||||
 | 
							<h2$hash.gradient> "Hash based router" | 
				
			||||
 | 
							<imba-code.no-code url="example.com/#/with/hash/url"> | 
				
			||||
 | 
							"Hash is meant for browser only. This way of routing doesn't require server at all. | 
				
			||||
 | 
							Very good for decreasing unnecessary request. | 
				
			||||
 | 
							Use it for dashboards and other functionalities which are not meant to be shown for anonymous user." | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							"Another use case is making standalone application which you can access even without internet - receive and | 
				
			||||
 | 
							copy further. In other words save to disk like 25y ago. Good for making tool applications - processing | 
				
			||||
 | 
							information which is mostly delivered by the user." | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							"For the same reason it's good for interfaces of distributed applications." | 
				
			||||
 | 
							<pro-tip> | 
				
			||||
 | 
								"If you will treat Hash as only store of data for your application your application already is distributed and trully serverless. Just compile it to one html file." | 
				
			||||
 | 
					
 | 
				
			||||
 | 
							<h2$both.gradient> "URL and hash together" | 
				
			||||
 | 
							<imba-code.no-code url="example.com/with/normal/url/#/and/hash/addition"> | 
				
			||||
 | 
							"Good idea is to mix both mentioned approaches together - and attach hash router to your standard application. | 
				
			||||
 | 
							In hash you can store information which is tighted to the client. For example interface configuration customised by the user." | 
				
			||||
 | 
							<pro-tip> | 
				
			||||
 | 
								"There's no conflict between url and hash - so you could use imba router for url and pro-router for hash." | 
				
			||||
 | 
					
 | 
				
			||||
 | 
							<h2$var.gradient> "Url variables based router*" | 
				
			||||
 | 
							<imba-code.no-code url="example.com/?view=with&variabled=url"> | 
				
			||||
 | 
							"URL variables are old standard which is going out of common use - considered ugly to read. Still the good thing is | 
				
			||||
 | 
							it's widely supported. It's supported by browsers and backends. It's great oportunity. You could use it in many ways. | 
				
			||||
 | 
							For example copy values from URL to your API requests. This would give easy way (for authorised only) to modify behaviour of your backend. | 
				
			||||
 | 
							Helpful for testing, debugging or switching feature flags." | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							<br> | 
				
			||||
 | 
							"* - surely coming soon in pro-router2" | 
				
			||||
					Loading…
					
					
				
		Reference in new issue