Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试在visual studio代码中运行服务器时出现express错误_Express_String Literals - Fatal编程技术网

尝试在visual studio代码中运行服务器时出现express错误

尝试在visual studio代码中运行服务器时出现express错误,express,string-literals,Express,String Literals,我以html模板代码的形式发送了请求,但我用一行代码编写它,它显示直接内容,但当我在其中中断行时,它显示字符串文字错误 const express = require('express') const app = express() app.get('/', (req, res) => { let result = 0 res.send(' <html> <body>

我以html模板代码的形式发送了请求,但我用一行代码编写它,它显示直接内容,但当我在其中中断行时,它显示字符串文字错误

    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')
    })
const express=require('express'))
const app=express()
应用程序获取(“/”,(请求,请求)=>{
设结果=0
res.send('
结果=${Result}
')
})
应用程序监听(3232,()=>{
console.log('服务器已在上启动http://localhost:3232')
})
res.send(`
结果=${Result}
`);
对多行字符串使用反勾号(`)

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