Accessing passed EJS variable in Javascript file

前端 未结 5 883
轻奢々
轻奢々 2020-12-05 12:05

RESTful routes js file:

// index route - show all todos
router.get(\"/\", middleware.isLoggedIn,function(req,res) {
  Todo.find({ \"author.id\" : req.user._i         


        
5条回答
  •  萌比男神i
    2020-12-05 13:12

    Only this works in my case. All versions with "" or with <%= fail.

    
    

    Thing to note: if using VS Code with formatting on save for .ejs files, <%- gets split into <% - and you get Uncaught SyntaxError: Unexpected token ';' and what worked a second ago, suddenly stops working.

提交回复
热议问题