世界上最伟大的投资就是投资自己的教育
https://github.com/typicode/json-server
https://github.com/Marak/faker.js
https://jsonplaceholder.typicode.com/
https://guides.rubyonrails.org/routing.html
https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa
https://www.qiuzhi99.com/playlists/xian-shang-fu-wu-qi-bu-shu-qian-hou-duan 线上服务器部署(前后端)
增删改查
本地开一个服务
自定义 api
以中间件的形式与 express 结合
高级的查询功能
http://localhost:3000/
http://localhost:3000/users
http://localhost:3000/companies
http://localhost:3000/users/1
http://localhost:3000/users/2
http://localhost:3000/companies/1/users
http://localhost:3000/companies/2/users
http://localhost:3000/users/1
http://localhost:3000/users?firstName=hfpp2012
http://localhost:3000/users?firstName=rails365
http://localhost:3000/users?firstName=rails365&age=30
http://localhost:3000/users?firstName=rails365&age=31
http://localhost:3000/users?firstName=rails365&firstName=tony
http://localhost:3000/users?q=rails
http://localhost:3000/users?_page=1&_limit=2
http://localhost:3000/users?_sort=age
http://localhost:3000/users?_sort=age&_order=desc
db.json
{
"users": [
{
"id": 1,
"firstName": "hfpp2012",
"lastName": "liang",
"email": "hfpp2012@gmail.com",
"age": 34,
"companyId": "1"
},
{
"id": 2,
"firstName": "rails365",
"lastName": "wei",
"email": "rails365@gmail.com",
"age": 31,
"companyId": "2"
},
{
"id": 3,
"firstName": "tony",
"lastName": "wei",
"email": "tony@gmail.com",
"age": 21,
"companyId": "2"
},
{
"id": 4,
"firstName": "rails",
"lastName": "wei",
"email": "rails365@gmail.com",
"age": 31,
"companyId": "2"
}
],
"companies": [
{
"id": "1",
"name": "google"
},
{
"id": "2",
"name": "aliyun"
}
]
}
index.js
const faker = require('faker');
const generateEmployees = () => {
let employees = [];
for(var id = 0; id < 50; id++) {
var firstName = faker.name.firstName();
var lastName = faker.name.lastName();
var email = faker.internet.email();
employees.push({
"id": id,
"firstName": firstName,
"lastName": lastName,
"email": email
})
}
return { 'employees': employees }
}
module.exports = generateEmployees
程序世界之速成课免费视频教程 #01 前端模拟 API 的最佳选择 json-server14:57
程序世界之速成课免费视频教程 #02 从零开始使用 Webpack 4 和 Babel 7 搭建 React 开发环境19:00
程序世界之速成课免费视频教程 #03 如何在 React (componentDidMount Async) 使用 Async Await 和 fetch22:52
程序世界之速成课免费视频教程 #04 从 fetch 和 promise 入手来聊聊 polyfills 和 ponyfills 以及同构09:51
程序世界之速成课免费视频教程 #05 探索前端项目或 Node.js 项目的环境变量和配置文件以及安全问题20:34
程序世界之速成课免费视频教程 #06 create-React-app 的 “坑” - 默认情况下线上环境能看到源代码11:09
▬▬▬▬▬▬ 联系我 👋 ▬▬▬▬▬▬
微信:qiuzhi99pro
b 站:https://space.bilibili.com/31152817
知乎:https://www.zhihu.com/people/rails365
Youtube:https://www.youtube.com/channel/UCA-Jkgr40A9kl5vsIqg-BIg
© 汕尾市求知科技有限公司 | Rails365 Gitlab | 知乎 | b 站 | csdn
粤公网安备 44152102000088号 | 粤ICP备19038915号
Top