JS 搜狐接口
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
document.write(returnCitySN["cip"] + ',' + returnCitySN["cname"])
</script>
Node.Js获取
使用request-ip库
npm i request-ip --save
const requestIp = require('request-ip');
const ipMiddleware = function(req, res, next) {
const clientIp = requestIp.getClientIp(req);
next();
};