Revision 2022. TARGET This tutorial is the 3rd step of the series and its code evolves from the 2nd step. The target is to apply Object-Oriented and MVC architecture concepts. The controller (the router) delivers to a business layer that accesses the persistence. FAST START FOR THE IMPATIENT – Help for linux (debian/ubuntu) install: … Read More “NODE.JS: SEQUELIZE: EVOLVING PERSISTENCE AND CREATING BUSINESS LAYER – 3RD STEP” »
Category: javascript
Revision 2022 A SEQUELIZE TUTORIAL SPLIT INTO STEPS USING Node.js 16 AND Express This series presents a sequential tutorial evolving from the simplest approach starting from scratch that evolves to an advanced application using Node.js , Sequelize, PostgreSQL and applying advanced software engineer concepts for software development through Object-Oriented(OO) approach using MVC architecture and … Read More “NODE.JS: SEQUELIZE TUTORIAL SERIES” »
Revision 2022 TARGET Post revised at 2022. CREATING THE VIEW LAYER USING STUBS This step of the project will create a Todo list as shown in the picture above, using Bootstrap. This project evolves from the 1st step. Now, let’s follow to the 2nd step. Projects need speed, so it goes faster using multiple development … Read More “NODE.JS: VIEW USING EXPRESS AND SEQUELIZE – 2ND STEP” »
Revision 2022 TARGET Learn Sequelize constructing a project using Node.js, Express, Sequelize for persistence using PostgreSQL, MariaDB (MySQL) or another database. Source code to download using Node.js v.16: GitHub, node_sequelize_ultering_ml40643_1st_step Project developed using Node.js version 16. Node: 16.13.1 Package Manager: npm 8.5.4 OS: win32 x64 (Windows 10) SUPER FAST START USING THE CODE FROM … Read More “NODE.JS: USING SEQUELIZE – EXPRESS PROJECT 1: SUPER SIMPLE PROJECT FOR BEGINNERS – 1ST STEP” »
/** * Wait until the test condition is true or a timeout occurs. Useful for waiting * on a server response or for a ui change (fadeIn, etc.) to occur. * * @param testFx javascript condition that evaluates to a boolean, * it can be passed in as a string (e.g.: “1 == 1” or … Read More “PHANTOMJS: ADDING TIMEOUT FOR WAITING RESPONSES” »
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
import angular = require(‘angular’); /* @ngInject */ export class SetFocus implements angular.IDirective { private $log: angular.ILogService; publicstaticFactory(): angular.IDirectiveFactory { return () = >newFocus(); } publiclink:angular.IDirectiveLinkFn = (scopeS: angular.IScope, elementS: JQuery, attrsS: angular.IAttributes) => { if (!this.$log) { this.$log=angular.injector([‘ng’]).get(‘$log’); } if (attrsS.focus===’true’) { elementS[0].focus() ; } scopeS.$on(attrsS.focus, (e) => { elementS[0].focus(); }); } }; // … Read More “ANGULARJS: TYPESCRIPT – USING DIRECTIVE FOR FOCUS” »
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” »