当前位置: 首页 > 工具软件 > Nide > 使用案例 >

AJAX 请求 NIDE 搭建简单服务

姜玮
2023-12-01
// ajax 请求4部曲

let xhr = new XMLHttpRequest();

xhr.open('GET','/api/user',true);

xhr.onload = function () {
    console.log(xhr.response);
}

xhr.send();




let express = require('express');

let app = express();

app.get('/api/user',(req,res)=>{
    res.json({name:'珠峰架构'})
});

app.listen(4000);

 

 类似资料: