Socket
Socket
Sign inDemoInstall

@hubspot/cms-lib

Package Overview
Dependencies
Maintainers
13
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hubspot/cms-lib - npm Package Compare versions

Comparing version 1.1.10-beta.0 to 2.0.0-beta.2

38

functions.js

@@ -10,12 +10,32 @@ const path = require('path');

const functionBody = `
exports.main = ({ accountId, body, params }, sendResponse) => {
console.log('Your HubSpot account ID: %i', accountId);
sendResponse({
statusCode: 200,
body: {
message: 'Hello, world!',
},
});
// Require axios library to make API requests
const axios = require('axios');
// This function is executed when a request is made to the endpoint associated with this file in the serverless.json file
exports.main = ({ accountId }, sendResponse) => {
// Use axios to make a GET request to the search API
axios
.get('https://api.hubapi.com/contentsearch/v2/search', {
params: {
portalId: accountId,
term: 'searchTerm',
},
})
.then(function(response) {
// Handle success
// The console.log statement will appear in the terminal when you run the hs logs CMS CLI command
// For full documentation, see: developers.hubspot.com/docs/cms/developer-reference/local-development-cms-cli#logs
console.log('Data received from the search API:', response.data);
// sendResponse is what you will send back to services hitting your serverless function
sendResponse({ body: { response: response }, statusCode: 200 });
})
.catch(function(error) {
// Handle error
// This is a simple example; error handling typically will be more complicated.
// For more information on error handling with axios, see: https://github.com/axios/axios#handling-errors
sendResponse({ body: { error: error.message }, statusCode: 500 });
});
};
`;
`.trim();

@@ -22,0 +42,0 @@ function createEndpoint(endpointMethod, filename) {

{
"name": "@hubspot/cms-lib",
"version": "1.1.10-beta.0",
"version": "2.0.0-beta.2",
"description": "Library for working with the HubSpot CMS",

@@ -34,3 +34,3 @@ "license": "Apache-2.0",

},
"gitHead": "5a9b738f08e63bea7bd274ad68257dacafbe113d"
"gitHead": "3a35a937f255ad1934694aca25cc96a351713f2f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc