- feathers-sequelize (coming tutorial one) — https://github.com/feathersjs/feathers-sequelize
- sails-waterline — http://waterlinejs.org/ https://kev.inburke.com/kevin/dont-use-sails-or-waterline/
- vue-sequelize https://codeburst.io/building-a-feature-complete-bookmarking-app-with-vue-js-express-and-sequelize-orm-b36506ebcb4c
- adonisJS — https://adonisjs.com/docs/3.2/database-setup
— trailsJS – supports ORM’s https://trailsjs.io/start (see ‘choose ORM’ )
- deepstream-sequelize (i still am convinced i can get this working successfully)
sails vs trails:
https://medium.com/jsbot/trails-vs-sails-1-89e2be2bce73
negative sails/waterline article:
https://kev.inburke.com/kevin/dont-use-sails-or-waterline/
from wolfram:
class User{
constructor( recordName ) {
this.record = ds.record.getRecord( recordName );
this.record.subscribe( this._processUpdate.bind( this ) );
}
_processUpdate( data ) {
if( this.record.name === ‘…’) {
// do stuff
}
}
}
(async () => { try { let result = await feathersApp.logout(); console.log(‘the result is: ‘ + result) } catch (e) { console.log(e); } } ) () ;
(async () => let logoutResult = await feathersApp.logout(); console.log(logoutResult); })().catch(e => { console.log(e) });
https://stackoverflow.com/questions/70883305/best-way-to-make-a-knex-request-from-inside-a-promise
from grokling slack:
return sequelizeTable.create({‘column1’:‘data one’,‘column2’:‘data two’})
// Chain on .create
.then(result => sequelizeTable.count( { ‘where’ : { ‘id’ : result.id } } )
// Chain on .count
.then(count => console.log(count))
// Here we return result to be used after this
.then(() => result)
)
.then(result => console.log(result.id))
.catch(err => console.log(‘ERROR ‘ + err))
If you don’t want to make smaller functions to make your code more readable, you’d do it something like this:
return table.create(…..)
.then( result => {
return table.count( { ‘where’‘ : {‘id’: result.id }}));
.then (count => {
console.log(count));
return count;
})
.then (count => {
if ( count > 123 ) console.log(” > 123: “ + result.id) else
console.log ( “<= 123: “ + result.id );
return something;
})
})
.catch( …….)
NODE:
‘use strict’
/*
function connect() {
return new Promise( (resolve, reject) => {
client.rpc.make (‘promise’, ‘provide data passed in – abcde’, (err, reply) => {
resolve(reply)
});
})
}
connect()
.then( (result1) => { return(‘RESULT1: ‘ + result1); })
.then( (result2) => { return(‘RESULT2: ‘ + result2); })
.then( (result3) => { console.log(‘RESULT 3: ‘ + result3); })
;
*/
to load underscore (or any cdn) into javascript:
var cdn = ‘https://code.jquery.com/jquery-3.2.1.min.js’ ;
var cdn = “https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js” ;
var cdn=‘https://cdnjs.cloudflare.com/ajax/libs/deepstream.io-client-js/2.1.2/deepstream.js’ ;
var jq = document.createElement(‘script’); jq.src=cdn;
document.getElementsByTagName(‘head’).appendChild(jq);
awesome way to use underscore to look up value in an object:
// _master is the object, sequelizeId is the index
console.log( _.findIndex(_master, (_tmpRow)=> { return _tmpRow.sequelizeId === ‘123456’ }) );
// 2017-09-26:
// https://stackoverflow.com/questions/37933445/underscore-js-find-object-which-contains-value-in-array
var master = [ { ‘name’ : ‘listOne’ , data : [ ‘nameOne’,‘nameTwo’] }
, { name: ‘listTwo’, ‘data’ : [ ‘nameThree’, ‘nameFour’ ] }
]
function findMe(myObj, myKey) {
var retVal=null;
_.each(myObj, (val)=> {
var byeBye = _.indexOf(val.data, myKey );
if ( _.indexOf(val.data, myKey ) > -1 ) {
retVal=val.name;
}
})
return retVal;
}
console.log( ‘RESULT: ‘ + findMe(master, ‘nameTwo’) )
1) FULL state name, no appreviation
2) organization name – no special characters
3) dont skip the “common name” – which is the domain name
openssl req -newkey rsa:2048 \
-keyout 800-language.com-WITH-PASSPHRASE.key \
-out 800-language.com.csr ;
Generating a 2048 bit RSA private key
…………………………………………………………………………….+++
…+++
writing new private key to ’800-language.com-WITH-PASSPHRASE.key’
Enter PEM pass phrase:
Verifying – Enter PEM pass phrase:
——-
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
——-
Country Name (2 letter code) [XX]:US
State or Province Name (full name) []:North Carolina
Locality Name (eg, city) [Default City]:Raleigh
Organization Name (eg, company) [Default Company Ltd]:800 Language
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:800-language.com
Email Address []:info@comptonpeslonline.com
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []: