I'm a little bit confused about this, and I feel slightly stupid asking this question, but I want to understand it.
So, say I'm working with a client side web framework, like Backbone, Angular or Durandal. This framework includes routing.
But I of course still have a server for database stuff, and so on, which also has routing.
My question now is:
When to use "client-side routing" or "server-side routing"?
How is it "decided" whether routing is already performed on the client side or whether the request is first sent to the web server?
I have a particularly hard time imagining this because the client side could do routing before the server ever gets to know about that request.
I'd be very thankful if someone could explain how these two routing systems work together.
P.S.: I have not included code samples because I'm not looking for an answer concerning a particular framework, but concerning the routing process in general.
tl;dr:
Imagine the user clicking on a simple link: <a href="/hello">Hello!</a>
On a webapp that uses server side routing:
href
tagIf the webapp uses client side routing:
Client-side routing sound more complicated, because it is. But some libraries really make it easy these days.
There are several upsides of client-side routing: you download less data to display new content, you can reuse DOM elements, display loading notifications to user etc. However, webapps that generate the DOM on server side are much easier to crawl (by search engines), thereby making SEO optimization easier. Combining these two approaches is also possible, the excellent Flow Router SSR is a good example for that.