我正在使用Express.js开发restAPI,我想知道是否有办法生成API文档,允许用户查看API定义,甚至可能尝试API调用?
我可以使用以下命令成功将文件上传到私有 S3存储桶:
aws s3 cp "myfile.txt" "s3://myfolder/myfile.txt" --region=us-east-1 --output=json
我想发出一个AWS CLI命令来返回myfile.txt的临时URL下载,有谁知道怎么做?
我google了,看起来我必须做一些签名来获取临时URL,例如:http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
我正在尝试使用Chef安装石墨服务器,我遇到错误,说在VM上找不到chef-solo或chef-client.我正在使用Ubuntu 12.04.amd64 LTS,这是服务器版本,所以它不会安装chef-client.我知道13版本将自动安装chef-client但我不能使用13版本.
我用谷歌搜索,看到有人建议ssh到盒子和apt-get install chef-client.
我的问题是:无论如何我可以在厨师开始之前预先安装厨师 - 客户吗?基本上我希望我的厨师程序下载原始图像,无需用户额外的手动步骤即可完成所有操作.可能吗?
我的Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-12.04-amd64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.hostname = "graphite"
config.vm.network :forwarded_port, guest: 8080, host: 9090
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.roles_path = "roles"
chef.data_bags_path = "data_bags"
chef.add_role "Graphite-Server"
chef.add_role "StatsD-Server"
end
end
Run Code Online (Sandbox Code Playgroud)
错误日志:
[default] Running provisioner: chef_solo...
The chef binary (either `chef-solo` or `chef-client`) was not found on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the …Run Code Online (Sandbox Code Playgroud) 在MongoDB生产中,如果键的值为空或未提供(可选),我应该使用空字符串值还是应该使用null作为值.
1)使用空字符串与null之间是否有任何利弊?
2)如果我将值设置为undefined以从现有doc中删除属性vs将属性值设置为空字符串或null,是否有任何优缺点?
谢谢
我看到在Node.js中创建配置文件的多种方法.一个在js文件中使用module.exports,一个只使用普通的json对象.
// config1.js
module.exports = {
config_1: "value 1",
config_2: "value 2"
}
Run Code Online (Sandbox Code Playgroud)
// config2.json
{
"config_1": "value 1",
"config_2": "value 2"
}
Run Code Online (Sandbox Code Playgroud)
在配置文件中使用module.exports有什么好处吗?有什么区别?
我创建了一个将数据发布到休息服务的示例,我发现当我有非ascii或非拉丁字符时(请参阅data.firstName),我使用TEST-REST.js的帖子请求将抛出
错误:{[错误:套接字挂断]代码:'ECONNRESET'}.
// TEST-REST.js
var http = require('http');
var data = JSON.stringify({
firstName: 'JoaquÌn',
});
var options = {
host: '127.0.0.1',
port: 3000,
path: '/users',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
var req = http.request(options, function(res) {
var result = '';
res.on('data', function(chunk) {
result += chunk;
});
res.on('end', function() {
console.log(result);
});
});
req.on('error', function(err) {
console.log(err);
});
req.write(data);
req.end();
Run Code Online (Sandbox Code Playgroud)
在我的休息服务,它给我这样的错误:
SyntaxError: Unexpected end of input Sun Sep 08 2013 23:25:02 GMT-0700 (PDT) - at …Run Code Online (Sandbox Code Playgroud) 我一直在寻找可以帮助我进行负载测试和基准测试的工具.我发现夫妇喜欢:https://github.com/wg/wrk,http://www.joedog.org/siege-home/,https://github.com/rakyll/boom.我想知道是否有人对这些工具有任何经验,并且对这些工具有任何反馈优点和缺点.我的负载压力将包括使用DELETE,PUT,GET,POST ...标头的不同测试用例
谢谢
我想知道是否有任何节点框架或节点库可用于编写shell脚本?例如,我有bash shell程序来安装Graphite和OpenTSDB RRD工具,我想用node.js来实现它,有可能吗?
谢谢
我有一个脚本使用令牌远程触发Jenkins上的作业.这是我的脚本:
JENKINS_URL='http://jenkins.myserver.com/jenkins'
JOB_NAME='job/utilities/job/my_job'
JOB_TOKEN='my_token'
curl "${JENKINS_URL}/${JOB_NAME}/buildWithParameters?token=${JOB_TOKEN}"
Run Code Online (Sandbox Code Playgroud)
运行后,我收到以下回复:
* Hostname was NOT found in DNS cache
* Trying 10.5.187.225...
* Connected to jenkins.myserver.com (10.5.187.225) port 80 (#0)
> GET /jenkins/job/utilities/job/my_job/buildWithParameters?token=my_token HTTP/1.1
> User-Agent: curl/7.37.1
> Host: jenkins.myserver.com
> Accept: */*
>
< HTTP/1.1 201 Created
* Server nginx/1.6.2 is not blacklisted
< Server: nginx/1.6.2
< Date: Tue, 03 Feb 2015 23:40:47 GMT
< Content-Length: 0
< Location: http://jenkins.myserver.com/jenkins/queue/item/91/
< Connection: keep-alive
< Cache-Control: private
< Expires: Wed, 31 Dec 1969 16:00:00 …Run Code Online (Sandbox Code Playgroud) 我想知道是否有最好的方法或最佳实践来获得Node.js中的完整应用程序.示例:我在子文件夹/apps/myapp/data/models/mymodel.js中有一个模块,我想获取应用程序的完整路径(不是文件的完整路径),这将返回我/ apps/myapp,我该怎么做?我知道_ dirname或_file仅相对于文件本身,而不是应用程序的完整路径.
node.js ×5
express ×2
amazon-s3 ×1
aws-cli ×1
benchmarking ×1
build ×1
chef-infra ×1
config ×1
javascript ×1
jenkins ×1
jenkins-cli ×1
json ×1
mongodb ×1
mongoose ×1
siege ×1
vagrant ×1
wrk ×1