my-json-server
点击访问:my-json-server
1. 创建db.json文件并提交至master/main
{
"posts": [
{ "id": 1, "title": "Post 1" },
{ "id": 2, "title": "Post 2" },
{ "id": 3, "title": "Post 3" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 },
{ "id": 2, "body": "some comment", "postId": 1 }
],
"profile": {
"name": "typicode"
}
}
2. 请求方式
访问 https://my-json-server.typicode.com/[你的用户名]/[你的仓库名]
,可以获取到api列表
比如,我的地址为:https://my-json-server.typicode.com/yuxiaoyujun/api
点击页面提供的链接就可以访问到对应的api
posts接口数据
https://my-json-server.typicode.com/yuxiaoyujun/api/posts
profile接口数据
https://my-json-server.typicode.com/yuxiaoyujun/api/profile