Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
not so sure how to declare a variable that will use in nodeJS and rendering in HTML/template

I'm using nodejs and Edge template to render dynamic data in HTMl elements , fed up with different solution but nothing seems working for me. I have used #App.locals, to declare the variable but getting function anonymous. So stick to original i want to return some data in x variable. I would appreciate your response , thank you.

code snippet : Example 1

const app =require(express)
const edge = require('edge.js')
app.use('*', (req, res, next) => {
edge.global('id', req.session.userId)
next()
});

here i'm getting an error as global is not a function

no luck so i run to different code

Example 2 :

const app =require(express)
var xvariable = {
id:"1"
}
app.use('*', (res, req, next) => {
app.locals = xvariable

console.log(id)  // expecting output as 1 but  getting function[asynchronous]

next()
});

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!