JSONP
业务逻辑本地处理,数据在云端
cors 跨域资源共享
//html
<h1>CORS</h1>
<script>
fetch("http://localhost:3000/")
.then(response => response.json())
.then(json => console.log(json));
</script>
//配置express => server
const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors())
app.get("/",(req,res,next)=>{
res.json(['name','imycode']);
})
app.listen(3000,()=>{
console.log("success");
})
参看:前端跨域请求及解决方案