如何在客户端访问res.locals

时间:2015-07-16 20:28:06

标签: javascript angularjs node.js express

我正试图在我的Express路线中使用req.userres.locals详细信息传递给我的客户端Angular代码:

'use strict';

var path = require('path');

var player = function(req, res) {
  res.locals.player = req.player;
  res.sendFile(path.join(__dirname, '../assets', 'index.html'));
};

module.exports = {
  player: player
};

HTML按预期呈现,但我现在不确定如何访问res.locals.player

0 个答案:

没有答案