Get Started with Node.js

Make sure you have polyfills for fetch and FormData installed before using @esri/hub.js. You can find npm install commands for all packages in the API reference.

npm install @esri/hub-initiatives @esri/arcgis-rest-request @esri/arcgis-rest-portal isomorphic-fetch isomorphic-form-data

Require the isomorphic-fetch and isomorphic-form-data modules before using any of the @esri/hub.js methods.

require("isomorphic-fetch");
require("isomorphic-form-data");

const { fetchInitiative } = require("@esri/hub-initiatives");

getInitiative("abc123").then(response => {
  console.log(response);  // Initiative item with data
});