Ideally the server should only be serving static files and to do that your express app should use some simple templating engine. This combined with a default loader in your HTML file should take care of the overall loading.
I have attached a prefetcher module below, a middleware, whose main purpose is to fetch the data required to render a route.
- You can have an
index.htmlwhich will be your skeleton file. I have demonstrated it using marko.js, you can use any other templating engine.