/csr-example

A simple demonstration of client-side routing.

Primary LanguageJavaScript

Client-side routing example - Live Demo

A simple demonstration of client-side routing.

Usage

devbox shell
caddy run

Then, go to http://localhost:3000 and click around.

Notes

Try going directly to one of the other pages:

  • http://localhost:3000/about
  • http://localhost:3000/login

Do you understand why it loads the index.html file and renders a different view?

Think about why you're still able to load http://localhost:3000/index.js from the web server.

GitHub Pages and Netlify

The website is hosted on GitHub Pages and Netlify:

Notice how you can't go directly to the about or login page with the GitHub Pages hosted site but, with the Netlify hosted site, you can.

See for yourself:

Resources