import fetch, { Headers } from "node-fetch" const headers = new Headers() //in reality, for security, you would store these values in an environment variable const ourPassword = "aldk dsic wqjs ifqs ofiqx jrww" const ourUsername = "rejauldu" headers.set("Content-Type", "application/json") headers.set("Authorization", "Basic "+Buffer.from(`${ourUsername}:${ourPassword}`).toString("base64")) fetch("https://ict4today.com/wp-json/wp/v2/posts", { method: "POST", headers: headers, body: JSON.stringify({title: "Post title", content:"Sample content", status: "publish"}) })