express error when try to run the server in visual studio code

Rushi Kadivar

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')
    })
rantao
res.send(`
    <html>
        <body>
            <h1>Result = ${result}</h1>
        </body>
    </html>
`);

Use backticks (`) for multi-line strings

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I have been using Visual Studio Code in my Mac. When I try to compile and run the program, it pops a message as 'Permission denied'

Why does visual studio gives me error when I want to run the GAMS code via C#?

Error when compiling Sass in Visual Studio Code

Visual Studio Code error when using Unity

error when i try to run app on emulator android studio

Visual Studio Code wont run code and gives no error message

Error when I run the Visual studio run task in CI

Tell server to not run the code when there is an error

When I try to use Node.js in Visual Studio Code’s terminal, I get “document is not defined” error messages

Error Twig when I try to run Symfony 3 project on server

Pygame window not responding error when i try to run a code

Steps to run node http server in visual studio code

Some file not served when run via Visual Studio Code

Error when trying to run on release mode Visual Studio 2015

What's the error "noDebug mode: unable to process 'evaluate' request" means when I use visual studio code to run Go?

Run JavaScript in Visual Studio Code

visual studio code error when debugging xunit test

ECCODES ERROR when opening .GRIB file in Spyder and in Visual Studio Code

Error when trying to debug Leetcode answer on Visual Studio Code

When I run the code chunks everything works but when I try to Knit I get an error

How to run unsafe code in "visual studio code"?

Visual Studio Code run code in the same terminal

Getting TypeError when try to run the python code

Why am i getting error when i try to assign string to istringstream object in visual studio in c++?

Why is the Visual Studio 2013 debugger closing without error when I try to expand Model properties?

Why does my javaFX code run fine on cmd, but throws an error in Visual Studio Code?

Visual Studio Code internet error

Visual Studio Code - Authentication Error

How to solve "Microsoft Visual Studio (VS)" error "Unable to launch the IIS Express Web server"