Skip to content

本地搭建简单服务器返回JSON数据(可同步到服务器端)

License

Notifications You must be signed in to change notification settings

we11cheng/WCMockApiJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Node搭建简单服务器接收请求返回数据

使用

git clone https://github.com/we11cheng/WCMockApiJson.git
cd gwcExpress/myapp
npm start

查看效果

 浏览器访问:localhost:3000/api/demo。
 浏览器访问:localhost:3000/api/demo2。
 其他接口直接在myapp/api/路径下添加xxx.js文件。添加完成访问localhost:3000/api/xxx.js

工作原理:创建一个express应用程序。

  • 检查是否安装node node -v

  • 检查是否安装npm npm -v

  • 全局安装express-generator模块

npm install -g express-generator
  • 创建一个名为myapp的express应用程序。改项目有改动。
express --view=pug myapp
  • cd myapp

  • npm start

About

本地搭建简单服务器返回JSON数据(可同步到服务器端)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published