Node.js 环境下 Cloud At Cost API 调用工具
Node-Catc: Cloud At Cost API 的 Node.js 包装器
Node-Catc 简化了 Node.js 环境下 Cloud At Cost API 的调用过程。
安装
npm install node-catc
使用示例
以下代码展示了如何使用 Node-Catc 获取服务器列表和模板列表:
var CatC = require('node-catc');
var api = new CatC('APIKEY', 'LOGINEMAIL');
// 获取服务器列表
api.listServers(function (err, res) {
if (!err) {
for (var i in res.data) {
console.log(res.data[i]);
}
}
});
// 获取模板列表
api.listTemplates(function (err, res) {
if (!err) {
for (var i in res.data) {
console.log(res.data[i]);
}
}
});
3.38KB
文件大小:
评论区