如何在 NodeJS 中发送 ZAP post 请求?

How to send a ZAP post request in NodeJS?

我的url是这样的:

https://hooks.zapier.com/hooks/catch/2020200/jasoa43

我的代码是什么?如何获取端口以及路径是什么?请检查以下代码并告诉我这些参数是什么。

const https = require('https')

        const data = 'data'
     
        const options = {
            hostname: ??,
            port: ??,
            path: ??,
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'Content-Length': data.length
            }
        }

        const req = https.request(options, res => {
            console.log(`statusCode: ${res.statusCode}`)

            res.on('data', d => {
                process.stdout.write(d)
            })
        })

        req.on('error', error => {
            console.error(error)
        })

        req.write(data)
        req.end()
 const https = require('https')

        const data = JSON.stringify({
         
            pin:change.after.data().pin,
            name:change.after.data().firstName,
            email:change.after.data().email,
            phone:change.after.data().phone,

        });
     
        const options = {
            hostname: 'hooks.zapier.com',
            port: 443,
            path: '/hooks/catch/5977644/ofrda44',
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'Content-Length': data.length
            }
        }

        const req = https.request(options, res => {
            console.log(`statusCode: ${res.statusCode}`)

            res.on('data', d => {
                process.stdout.write(d)
            })
        })

        req.on('error', error => {
            console.error(error)
        })

        req.write(data)
        req.end()