No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    SSR Questions

    Help
    2
    3
    330
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Blaconix last edited by Blaconix

      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?

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Hi,

        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.

        1 Reply Last reply Reply Quote 0
        • B
          Blaconix last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post