SSR Questions

  • So, I’ve integrated the quasar-ssr with another web server instead of express, but while changing the code I’ve noticed:

    if (ssr.settings.pwa) {
      app.use('/service-worker.js', serve('service-worker.js'))
    // serve "www" folder
    app.use('/', serve('.', true))

    And this might be a pretty foolish question, but why are we both statically serving (PWA not enabled) and SSR’ing with ssr.renderToString? I believe it’s some kind of fallback, but can someone clarify it to me exactly?

  • Admin


    Static files do not need to go through Vue rendering (which would add unnecessary overhead). Instead, we instruct Express to serve them, and this happens before renderToString() so that the Express router will match those files early. This makes the webserver a lot faster.

  • Hey, thanks a lot for the response. On that note, I have another question:

    Should the API server be the same as the SSR server or should I separate them? In my mind it makes a lot of sense to only have one server, but maybe it’s better the other way. What do you think?

Log in to reply