How to realize batch deletion by using RESTFUL API in json-server

when using vue to manage the system in the background, there will be batch deletion operations, but after finding a lot of information, it still can not be solved. I hope to get your help.

axios({
  method: "delete",
  url: that.baseURL,
    params: {
      id: [1,2]
    },
  headers: {"Content-Type": "application/json"},
  responseType: "json"
}).then(function (response) {
  console.log(response)
}).catch((error) => console.log(error))

data can be deleted when URL is set to thatbaseURL/id, and data cannot be deleted if params is set to id:1. An error is reported below. Does delete not support setting params?

attached server.js section configuration:

server.use(jsonserver.rewriter({
  "/api/": "/",
  "/api/users": "/users",
  "/api/users/:id": "/users/:id",
  "/api/users\\?id=:id": "/users/:id"
}))

if you find any mistakes, or if you have any suggestions, I hope you can give us some suggestions!

Mar.02,2021

/ api/users\\? id=:id change to / api/users?id=:id try

Menu