dashersw / cote-workshop Goto Github PK
View Code? Open in Web Editor NEWMicroservices case study with cote.js
Home Page: http://github.com/dashersw/cote
License: MIT License
Microservices case study with cote.js
Home Page: http://github.com/dashersw/cote
License: MIT License
If I shutdown the payment-service and then the user buy something, its purchases won't be correctly be sent.
Result in the admin console:
, 2, , , 5
On the Users list.
Hi,
Two or more end users are connected. One of them purchases some products. New remaining stock quantities are updated on his/her page. But they are not updated on the pages of the other end users on real time.
Tia
Plenty errors!
npm WARN deprecated [email protected]: letsencrypt has been renamed to greenlock. Please find it at npm greenlock
npm WARN deprecated [email protected]: Please use the 'safe-timers' module instead
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: this package has been deprecated
npm WARN deprecated [email protected]: stop using this version
../src/ursaNative.cc:389:13: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
...
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-23-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pavlos/SharedFolder/Frameworks/cote/cote-workshop-0.13.2/node_modules/ursa
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
../node_modules/nan/nan_maybe_43_inl.h:112:15: error: ‘class v8::Object’ has no member named ‘ForceSet’
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I use node 10.5.0
Tia
Hi,
I watched this https://www.youtube.com/watch?v=JgqDajrdSrY and it states that the databases should be separate for each of the services. On inspection of Model.js
I can see that it is not.
Could you make an example where it is?
Thanks,
Jamie
Hi Armagan,
I love the succitness and elegance of cote, its always worked for until now, I have this minor problem and have tried everything with no good result yet, what am i doing wrong in calling like this, "res.redirect(bitrix24.auth.authorization_uri);" is it forbidden to call the internal app.get from cote, how can i go around this?
`const app = require('express')(),
server = require('http').Server(app),
io = require('socket.io')(server),
cote = require('cote');
const b24 = require('b24');
// A Responder that shall listen for the Rest Api calls
const responder = new cote.Responder({ name: ' bitrix rest calls API responder ' });
const ios = new cote.Sockend(io, { name: 'end-user sockend server' });
// // A Publisher that shall notify for the Rest API calls
// const publisher = new cote.Publisher({ name: 'arbitration publisher' });
// const subscriber = new cote.Subscriber({ name: 'arbitration subscriber' });
// B24 setup
const bitrix24 = new b24.Bitrix24({
config: {
mode: "api",
host: "wwwwww",
client_id : "xxxxxxxxxxxxx",
client_secret : "xxxxxxxxxxxx",
redirect_uri : "xxxxxxxxxxxxxxxxxx"
},
methods: {
async saveToken(data){
//Save token to database
},
async retriveToken(){
//Retrive token from database
return {
access_token: "youraccesstoken",
refresh_token: "yourrefreshtoken"
}
}
}
})
app.get('/auth', function (req, res) {
console.log(${req.ip} requested end-user interface
);
res.redirect(bitrix24.auth.authorization_uri);
res.sendFile(__dirname + '/index.html');
});
server.listen(3000);
// Bitrix auth
responder.on('api', (req, res) => {
ios.connect('/auth');
});
// Callback service parsing the authorization token and asking for the access token
app.get('/callback', async (req, res) => {
try{
const code = req.query.code;
console.log(code);
const result = await bitrix24.auth.getToken(code);
console.log(result);
return res.json(result);
}catch(err){
console.log(err)
return res.status(500).json({message:"Authentication Failed"});
}
});`
Thank you so much..
Error ORMError: Connection protocol not supported - have you installed the database driver for sqlite?
at Object.exports.connect (C:\Users\L\Downloads\code\js\cote-workshop\node_modules\orm\lib\ORM.js:131:24)
at Object. (C:\Users\L\Downloads\code\js\cote-workshop\models.js:10:14)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Module.require (node:internal/modules/cjs/loader:972:19)
at require (node:internal/modules/cjs/helpers:88:18)
at Object. (C:\Users\L\Downloads\code\js\cote-workshop\init-db.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47 {
code: 4,
literalCode: 'NO_SUPPORT'
}
When initializing database:
node init-db.js
Initializing db.
{ Error: SQLITE_ERROR: table product
already exists errno: 1, code: 'SQLITE_ERROR', model: 'product' }
node v10.0.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.