百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

json-server

> 前端框架
开源

在不到 30 秒内获得完全的虚拟 REST API,无需编写任何代码(真的)

75.7K stars0 点赞3 次浏览
访问官网GitHub

工具介绍

在不到 30 秒内获得完全的虚拟 REST API,无需编写任何代码(真的)

JSON-Server > [!IMPORTANT] 查看测试版 v1 文档 - 可用,但可能会发生更改。 稳定版请参阅 这里 > [!NOTE] 使用 React ⚛️ 而厌倦了 CSS-in-JS 吗? 请参阅 MistCSS ## 安装 ```shell

npm install json-server ## 使用 创建 `db.json` 或 `db.json5` 文件json { "$schema": "./node_modules/json-server/schema.json", "posts": [ { "id": "1", "title": "a title", "views": 100 }, { "id": "2", "title": "another title", "views": 200 } ], "comments": [ { "id": "1", "text": "a comment about post 1", "postId": "1" }, { "id": "2", "text": "another comment about post 1", "postId": "1" } ], "profile": { "name": "typicode" } } <details> <summary>查看 db.json5 示例</summary>json5 { posts: [ { id: "1", title: "a title", views: 100 }, { id: "2", title: "another title", views: 200 }, ], comments: [ { id: "1", text: "a comment about post 1", postId: "1" }, { id: "2", text: "another comment about post 1", postId: "1" }, ], profile: { name: "typicode", }, } 您可以在 [这里](https://github.com/json5/json5) 详细了解 JSON5 格式。 </details> 启动 JSON Serverbash npx json-server db.json 这将在 `http://localhost:3000`.` 上启动服务器。 您应该看到: JSON Server started on PORT :3000 http://localhost:3000 访问您的 REST API:bash curl http://localhost:3000/posts/1 **响应:**json { "id": "1", "title": "a title", "views": 100 } ``` 请运行 json-server --help 以查看选项列表 ## 赞助商 ✨ ### 黄金

<a href="http://

Issues· 719 开放

查看全部 Issues在 GitHub 打开
  • #1775

    负责任的披露

    更新于 2026年9月22日
  • #1412

    从日志中隐藏成功的 XHR 请求

    更新于 2026年8月7日
  • #1768

    对

    更新于 2026年7月15日
  • #725

    DELETE 删除的条目多于它应该删除的条目

    更新于 2026年6月8日
  • #1633

    全文搜索无法正常运行

    更新于 2026年5月24日
  • #1311

    在 db.json 中开始 Json-Server 错误

    更新于 2026年5月24日
  • #1557

    在 node_modules 中找不到 json-server 包

    更新于 2026年5月24日
  • #1610

    请添加关于 json 数据变化的 Server- Send- Events

    更新于 2026年5月24日
  • #1634

    使用 _embed 与 persons 表时产生意外输出

    更新于 2026年5月24日
  • #1765

    特性: 当 db 包含原始数组作为资源时, 添加可选启动警告

    更新于 2026年5月24日

> 标签

JavaScriptapifakefrontendjson

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月29日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架