Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3655

error in rendering a RESTful comments in ejs

$
0
0

when working with ejs and render a file of comments contains username and comment it only renders the username and the comments is not rendering at all

index of comments

const comments = [    {        username:'memo' ,        Comment:'ha ha ha hahaha'    },    {        username:' makrom' ,        Comment:'xy xy xy xyxyxyxyxyxy'    },    {        username:'meno' ,        Comment:'that is so funny'    },    {        username:'mena' ,        Comment:'here is a comment'    }]
app.get('/comments' , (req , res) => {    res.render('comments/index' , { comments })})

EJS

<% for (let c of comments){ %><li> <%= c.username%> - <%=c.comment%></li><% } %>

expected to render the username and its comment but it only render the username


Viewing all articles
Browse latest Browse all 3655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>