输入地址3030/getlist, 页面上的json数据一直无法出现,说无法相应数据
const http = require('http')
const url = require('url')
http.createServer(function (req, res) {
//获取请求路径
const {pathname} = url.parse(req.url);
if (pathname == '/') {
res.end('hello')
}else if (pathname == '/getlist') {
console.log("cccc")
res.writeHead(200, { "Content-Type": 'aplplication/json;' });
res.write(JSON.stringify({ records: [{ name: 'fyx' , age : 12}] }))
res.end()
}else{
res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
res.end('默认值')
}
}).listen('3030', function () {
console.log('服务器正在监听3030端口')
})

