使用NodeJS、ExpressとSequilize、SequelizeInstanceオブジェクトはエクスプレスハンドルバービューでレンダリングしていない(NodeJS、エクスプレス)
私は私の見解でレンダリングしています[オブジェクトSequelizeInstance:藤堂]実際のデータインスタンス値に反対するとして、解像度と呼び出されたとき.render()は、.send(以下のコメント行参照)によって呼び出されたときに、データインスタンスの値がビューに送られます。
exports.test_todo_view = function(req, res) {
return Todo
.findAll({
//attributes: ['id'] //select fields
})
//.then((todos) => res.status(200).send(todos))
.then((todos) => res.render('test/test_view', {layout: 'ca_layout.handlebars', test_data: todos}))
.catch((error) => res.status(400).send(error));
}
出力は、データベース内の各エントリの[オブジェクトSequelizeInstance:Todo]です。
誰も助言できますか?つまり、私が.send(todos)を使用すると、データ - [{"id":1、 "title": "fasdfsd"、 "createdAt": "2017-11-15"示されるように。
私はビューを呼び出すために以下を使用しています。
app.get('/test/view', authCarePlan.test_todo_view);
マイ.handlebarsファイルには、私は、クエリの出力は、以下の設定が.handlebarsビューで必要とされたTEST_DATA