如何在 Node JS 中使用 PATCH 方法更新单个 属性?

How to update a single property using PATCH method in Node JS?

我想创建一个 PATCH 方法来为我的 API 更新单个 属性,但有些东西我不明白。

你应该清楚post你的问题,这是我的理解,如果你在node.js

中使用request npm,我希望这对你有所帮助
var request = require('request');

request.patch(
    //First parameter API to make post request
    'https://example.com/api/users',

    //The second parameter, DATA which has to be sent to API
    { json: {
        name: "paul rudd",
        movies: ["I Love You Man", "Role Models"]
      } 
    },
    
    //The third parameter is a Callback function 
    function (error, response, body) {
        if (!error && response.statusCode == 200) {
            console.log(body);
            console.log(response.statusCode);
        }
    }
);

for more information read here