Here are my codes
let list = ctx.get("list.json");
ctx.set("Content-Type", "application/json");
await ctx.render('index', {
somecontent:onecontent,
seconddata: list
});
In index.ejs
<%=seconddata%>
It shows the content [object Promise]
, What do I do to show all datas of seconddata
?
Without seeing more of your code...
You could try JSON.stringify()
Also, since it looks like list
is a Promise object, you might want
let list = await ctx.get('list.json')
so that list
is an array of resolved Promises (which is likely closer to what you want).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.