I am starting to learn Node JS. I am trying to set global values available to all templates using below code.
const { default: edge2 } = require("edge.js");
app.use("*", (req, res, next) => {
edge.global('name','Test');
next();
});
But I am getting an error ‘[ERR_REQUIRE_ESM]: require() of ES Module…not supported. Instead change the require’ to a dynamic import() which is available in all CommonJS modules.
Is there any workaround for this ? Thanks in advance !