خرید بک لینک

Vote count: 0

The title was kind of hard to write correctly, so I hope I can explain this well enough.

I have a function defined in the main function of my application...

let renderTemplate = (req, res, view, model) => {
  res.render('template',
             {
               'view': view,     
               'model': model 
             });
}

And then I use it in multiple, small controller-esque files, like so

let foo = (req, res) => {
   renderTemplate(req, res, 'index', {});
}

The question is: How do I include renderTemplate in all of my controller-esque classes without placing it in or injecting the code per file?

asked 26 secs ago

برچسب: js function was used before it was defined, نویسنده: استخدام کار تاريخ: سه شنبه 26 مرداد 1395 ساعت: 0:11

صفحه بندی