Reputation: 496
I created an ssr node expressjs app with some client adjustable settings that are stored in a database. Examples are enable_feature_x='y'
and url_logo='https://domain.tld/logo.png'
.
Currently I load the variables in app.js
, then I store them in app.locals
and access them in the templates. But I somehow can't access them in routes. How can I access the app
from within the routes?
I would like to be able to set them globally from app.js
(on startup) and from an imported route (on update), and read them globally in any route and template.
I am sure this is a common problem, but I haven't found a solution yet. Any hints?
Upvotes: 0
Views: 39