Node.jsからrenderされたobjectをクラアント側のJs取得するにはどうすればよいのでしょうか?
app.js(サーバーサイド)
javascript
1router.get('/', (req, res) => { 2 text="hello world!" 3 res.render('index',{'sessions':req.session,'text':text}) 4})
index.handlebars
handlebars
1<head> 2 <title>クライアント</title> 3<head> 4<body> 5 ←これは表示される 6 <script> 7 console.log(sesssions.user.email)//ここでsessionが見つかりませんというエラーが出る 8 console.log(text) 9 </script> 10</body>
あなたの回答
tips
プレビュー