0

I sent the request in form of html template code but i write it in single line it shows direct content but when i brake the line in it shows string literal errors

    const express = require('express')

    const app = express()


    app.get('/', (req, res) => {
        let result = 0

        res.send('
        <html>
        <body>
            <h1>Result = ${result}</h1>
        </body>
        </html>
        ')

    })

    app.listen(3232, () => {
        console.log('server started on http://localhost:3232')
    })
Rushi Kadivar
  • 101
  • 1
  • 7

1 Answers1

0
res.send(`
    <html>
        <body>
            <h1>Result = ${result}</h1>
        </body>
    </html>
`);

Use backticks (`) for multi-line strings

rantao
  • 1,621
  • 4
  • 14
  • 34