Serving Single-Page Applications in Go

Someone may ask what is so special about serving single-page applications? Well, if you use hash (#) based URL’s like https://yourdomain.com/#/yourroute , there is no problem because browser recognize that this is a default page with some parameters and doesn’t make another request to the server. However, if you want to use non-hash based routes, there is a problem if you try to refresh a non-default route. In this case browser’s default action is to load such URL from the server and there is no such document on the server. For example, if you load your SPA at URL https://yourdomain.com and then you click on another route, you will see in your browser’s URL field something like https://yourdomain.com/yourroute . That works fine unless you try to reload the page. In that case browser doesn’t know this is actually already loaded SPA, but it actually tries to fetch /yourroute URI from server. As there is no such URI on the server, you will usually get the famous 404 error and your application breaks. ...

2020-05-03 · 3 min · Boban Acimovic

Svelte await blocks

Few weeks ago I came across Svelte, a radical new approach to building user interfaces (quote from Svelte homepage ). Svelte is actually a compiler, not tradional framework like React, Angular or Vue, but it can do pretty much everything as the mentioned ones. It doesn’t use virtual DOM, but instead it compiles to vanilla JavaScript and access the DOM directly. As a consequence, Svelte generated JavaScript is very small comparing to competition, but also quite fast. ...

2020-01-15 · 2 min · Boban Acimovic