EJS characters <% causes 404 even when commented out

Viewed 23

So I have a webpage thats being loaded with EJS. Work's fine cool. Now I would like to pass some information to the client via ejs using '<%- variable %>.

Example : Server

router.get('/redirect',
    async function(req,res,next){
        try{  
            enterprise = await Enterprise.CreateEnterprise(req.query.enterpriseToken, signupUrl.data.name)
            let enterpriseName = enterprise.data.name
            //let namesubstring = enterpriseName.substring(12,22)
            //console.log(enterpriseName)
            //enterpriseObject['name'] = namesubstring;
            console.log('render')
            res.render('dashboard',{response: enterpriseName})
        }catch(error)
        {
            console.log('Made it to error handling ')
            console.error(error)
        }
    }
)

Client:

<script>
    console.log('<%- response %>')
<script>

Make sense right. It should work but i'm getting a 404 when i actually try to load the page. I automatically stop getting the 404 after I remove the <%- from the EJS file. I'm not understanding why these 3 characters are making the webpage break and throw 404. Thank you in advance.

0 Answers
Related