我正在按节点运行Express Server,我看到了很多站点,当您通过浏览器在那些站点中打开json对象时,您会在右上角看到“原始|已解析”标签,您能告诉我如何切换在这个选项上? 我的代码:
const express = require('express')
const app = express()
app.get('', (req, res) => {
res.send('<h1>Weather</h1>')
})
app.get('/help', (req, res) => {
res.send([{
name: 'Andrew'
}, {
name: 'Sarah'
}])
})
app.get('/about', (req, res) => {
res.send('<h1>About</h1>')
})
app.get('/weather', (req, res) => {
res.send({
forecast: 'It is snowing',
location: 'Philadelphia'
})
})
app.listen(3000, () => {
console.log('Server is up on port 3000.')
})