run: npm init npm i @types/node tsc –init into tsconfig.json, uncoment the line below: “moduleResolution”: “node” /* Specify module resolution strategy: ‘node’ (Node.js) or ‘classic’ (TypeScript pre-1.6). */ Leonardo Regis
Tag: nodejs
const aws = require(‘aws-sdk’); const sns = new aws.SNS(); sns.publish( { Message: message, TopicArn: ‘TOPIC_ARN’ }, function(err, data) { if (err) { console.log(err.stack); return; } console.log(‘push sent’); console.log(data); } ); Leonardo Regis
Create the permission in IAM: … { “Effect”: “Allow”, “Action”: [ “s3:putObject” ], “Resource”: “arn:aws:s3:::my_corporate_bucket/*” } … Tips: You can get the resource ARN just by clicking the bucket and clicking into the button “Copy Bucket ARN” take a look into the link: api on amazon the name of the allowed operations are the fuction ones … Read More “AWS: S3: NOJEJS – PUTOBJECT” »
A sample of creating a get request using nodejs on https let https = request(‘https’); const options = { hostname: ‘www.panda.tv’, path: ‘ajax_chatinfo?roomid=89757’, headers: { ‘User-Agent’: ‘Mozilla/5.0’ } }; console.log(‘generated options’ + options); const req = https.get(options, (res) => { let body = ”; console.log(‘Status:’, res.statusCode); console.log(‘Headers:’, JSON.stringify(res.headers)); res.setEncoding(‘utf8’); res.on(‘data’, (chunk) => body += chunk); … Read More “NODEJS: HTTPS – QUICKSAMPLE” »