Pass global object from SSR extension.js to boot files
See original GitHub issueIs there are any way to pass object from SSR extension.js
to the boot file, so it can be used.
The idea: create a client, that can be used as a global object in SSR mode, on the low level there will be a clear cache URL, and in boot it will be used. Once I trigger /clear-cache
object on the high level will be cleared.
I’ve checked this file (https://github.com/quasarframework/quasar/blob/dev/app/lib/dev-server.js#L232), seems like there are only context (app
) object with req
, res
and url
is passed to the boot loaders. Seems like there are no way to pass any object from express to vue app.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Boot files - Quasar Framework
A boot file is a simple JavaScript file which can optionally export a function. ... pass an object with the following properties to...
Read more >Accessing global object from content script in chrome extension
I have defined a global object in a .js file. For example file1.js contains the global object SomeObject. This file gets loaded in...
Read more >Server-Side Rendering (SSR) - Vue.js
Create a new directory and cd into it · Run npm init -y · Add "type": "module" in package.json so that Node.js runs...
Read more >Server-side rendering (SSR) with Angular Universal
A Node.js Express web server compiles HTML pages with Universal based on client requests. To create the server-side application module, app.server.module ...
Read more >How to Enable Server-Side Rendering for a React App
Server-side rendering (SSR) is a popular technique for rendering a client-side single ... Next, add the following code to the Home.js file:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dmitry You could probably attach it to the
req
object:And get it in boot:
Which is maybe a bit hacky, but only way I can think of getting it to work in dev mode without modifying the core code.
In production, I believe you could do it right in index.js by passing another var into renderToString, but a quick look at the core code and I see no way to do it via dev mode.
Idea is something like that:
Then in boot
And then access in Vue components through the store object.