使用nodejs模拟http接口的返回

 index.js代码如下

一、没有设置请求参数的index.js

1.1 post请求

1.2 接着往下写,get请求+监听端口设置:

1.3 index.js编写完成后,在cmd中运行,node index.js(前提示先进入index.Js文件所在目录)

 ctrl+C退出运行

1.4 index运行过程中,使用postman请求对应接口,得到对应的返回

 二、*带请求参数的index.js

原文地址:https://www.cnblogs.com/hushuer/p/12924673.html