【问题标题】:How to set home route in json-server如何在 json-server 中设置主路由
【发布时间】:2019-05-20 22:41:29
【问题描述】:

如何将 json-server 中的主路由设置为 "/api" 而不是 "/"? 我试过这个:

server.use(jsonServer.rewriter({
  "/api/": "/"
}));

但是,它不起作用

【问题讨论】:

  • 你试过"/api/*": "/$1"吗?
  • 我把作为别人的答案。

标签: reactjs json-server


【解决方案1】:

使用"/api/*": "/$1",您应该匹配路由/

https://github.com/typicode/json-server#add-custom-routes

【讨论】:

    猜你喜欢
    • 2017-03-17
    • 2015-07-05
    • 1970-01-01
    • 2022-11-26
    • 1970-01-01
    • 2017-07-09
    • 1970-01-01
    • 2019-12-21
    • 1970-01-01
    相关资源
    最近更新 更多