In ejs you could do:
put this in your ejs file
var shapes = <%=the-Array-Of-Shapes%>
from the route use:
app.get('/your-route',(req,res)=>{
res.render('your-ejs-file',the-Array-Of-Shapes);//here you are passing the array and the renderer will do the job
})
2
solved Accecing server side variable in Javascript(node.js, express.js, ejs) [closed]