What is the drop out rate here?

@taariya I’m working on the voting app now. I had exactly the same problem as you, how do you access vars from the backend with your frontend js or html files and vice versa? I found that .ejs is the easiest solution. This and thoroughly studying the Clementine.js app that fcc provides.
ejs is just html with the addition of being able to embed javascript. This means that in your express route you can add an object with vars you want to access in the front end (res.render(‘index.ejs’, {myVar : myVar}); ) and in the ejs file you just add <%= myVar %> where you need it. If you add something like to the ejs file you can also access this var in your front end js.
Using ejs means I don’t have to learn aNOther language/syntax (like jade or angular) and can just keep going.

1 Like

Sorry for the late reply, I’ve been busy with college apps lately and haven’t been on for a while. So basically you would have the regular backend with express/mongo/node and then in your html file you would have some code like:

“< p><%=myVar%>< /p>”

to display to the user your variable (i.e. the number of votes or something)?

This seems really helpful and I need to do some research on this so I can get on with the voting app.