Next.js Discord

Discord Forum

initializing a value which can be reused later in startup

Unanswered
Western Meadowlark posted this in #help-forum
Open in Discord
Western MeadowlarkOP
I have an express js API. On startup I set some values to the locals which I can then access on subsequent api calls

const app = express();

(() => {
  //some logic
  app.locals.someField1 = "some value";
  app.locals.someField2 = ["more", "values"];
})();


Any strategies for doing something like this in Next?

0 Replies