
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
sweetp-base
Advanced tools
Base module to write services for Sweetp server to automate your development workflow.
Features:
var service, methods, client, sweetp, log;
log = require('sweetp-base/lib/log')('YOUR SERVICE NAME:internal:');
sweetp = require('sweetp-base');
// service methods with sweetp meta data
service = {
// add methods as properties of the service object, the key is used as target
yourMethod:{
// target:"/yourService/your/own/target/string/", /* optional! */
options: {
// description which params you need from sweetp
params: {
// use URL to call other services
url: sweetp.PARAMETER_TYPES.url,
// define own parameters
myOwnParam: sweetp.PARAMETER_TYPES.one,
// or fetch config
config: sweetp.PARAMETER_TYPES.projectConfig
},
// add simple descriptions so everyone knows what this method does
description: {
summary:"Get user and password for 'key'.",
example:"more fancy text here, you can use HTML here",
returns:"a string with text"
}
},
// assign a function to the "fn" property, this gets executed when the service method gets called
fn:function(params, callback) {
// create unicorns here or any other fancy stuff which makes you more productive
log.debug("Search for unicorns.");
log.info("I create beautiful unicorns.");
log.warn("uh oh, no unicorns??");
log.error("No unicorns!!!! :(");
return callback(null, "This is your response and can be a String or JSON.");
}
},
};
// create service methods and start sweetp service (client)
methods = sweetp.createMethods(service, '/yourService/');
client = sweetp.start("YOUR SERVICE NAME", methods);
Put this in a file like /somedir/foo.js. Add this to your Sweetp services.json file:
{
"id":"example-node-service",
"exec":[
"node",
"foo.js"
],
"dir":"/somedir/"
}
Now (re-)start Sweetp server and you should be able to call your example service with http://localhost:7777/services/yourService/yourMethod :-)
Calling an other service is easy. Fetch the url of the Sweetp server your
service is running with parameter type sweetp.PARAMETER_TYPES.url. Add
parameters for the service call as simple map and put in the other parameters:
var callback = function (err, result) {
console.log('result from service call', result);
};
var params = {
title:'This is my title',
message:'This is my message'
};
sweetp.callService(url, "noproject", "ui/dialog/password", params, false, callback);
This would call the service "ui/dialog/password" of project "noproject", which runs in the same Sweetp server instance as your service. As result you going to get the answer of the called service.
See JVM version for more details.
sweetp.PARAMETER_TYPES.url = "url";
sweetp.PARAMETER_TYPES.one = "one";
sweetp.PARAMETER_TYPES.projectConfig = "projectConfig";
sweetp.PARAMETER_TYPES.list = "list";
sweetp.PARAMETER_TYPES.request = "request";
FAQs
Base module to write services for Sweetp server to automate your development workflow.
We found that sweetp-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.