尝试在visual studio代码中运行服务器时出现express错误
我以html模板代码的形式发送了请求,但我用一行代码编写它,它显示直接内容,但当我在其中中断行时,它显示字符串文字错误尝试在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>
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>
`);