Having trouble with IBM BlueMix when integrating Twilio and Parse - node.js

I am having difficulties finding the correct module for Parse when deploying onto IBM BlueMix. I have tried the following:
var Parse = require('node-parse-api').Parse;
This works locally because I used npm-install for parse but I am unsure of how to include this module on IBM BlueMix.

Using cf push <appname> will deploy node-parse-api into Bluemix.
Add the node-parse-api in the package.json file for your node.js application
Example:
{
"name": "NodejsStarterApp",
"version": "0.0.1",
"description": "A sample nodejs app for Bluemix",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "4.12.x",
"cfenv": "1.0.x",
"node-parse-api": "0.3.8"
},
"repository": {},
"engines": {
"node": "0.12.x"
}
}

Related

Hyperledger Fabric / Nodejs - what's the difference between running a contract with node and fabric-chaincode-node

When browsing the fabric-samples repository that contains examples in Node.js, I noticed that some chaincodes use fabric-chaincode-node while other chaincodes only use node when executing the npm start command:
with fabric-chaincode-node example:
"name": "fabcar",
"version": "1.0.0",
"description": "FabCar contract implemented in JavaScript",
"main": "index.js",
"engines": {
"node": ">=12",
"npm": ">=6.9"
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha --recursive",
"start": "fabric-chaincode-node start"
},
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-contract-api": "^2.0.0",
"fabric-shim": "^2.0.0"
}
with node only example:
{
"name": "abstore",
"version": "1.0.0",
"description": "ABstore chaincode implemented in node.js",
"engines": {
"node": ">=8.4.0",
"npm": ">=5.3.0"
},
"scripts": {
"start": "node abstore.js"
},
"engine-strict": true,
"license": "Apache-2.0",
"dependencies": {
"fabric-shim": "^2.0.0"
}
}
I would like to know what is the difference between running npm start command using fabric-chaincode-node and node. Depends on Hyperledger Fabric version? It depends on what packages I'm using, i.e. fabric-shim only needs node, while fabric-contract-api needs fabric-chaincode-node to run correctly?
Samples starting the chaincode with node abstore.js will be older samples using the lower-level fabric-shim API directly to implement the smart contract. The code being run will include a line similar to shim.start(new Chaincode()); to programmatically launch the chaincode.
Samples starting the chaincode with fabric-chaincode-node start are more current samples using the newer fabric-contract-api API to implement the smart contract. This API is based on and extends the fabric-shim API, and is the recommended approach.
There is a more detailed description of how to use the current APIs here:
https://github.com/hyperledger/fabric-chaincode-node/blob/main/TUTORIAL.md

Deploying front-end (React) and back-end (NodeJs) to Surge

I would like to deploy my video-chat app to Surge. I have two main folders: client with front-end part and server with back-end side. In client folder I am making build and then in that folder $surge. Sadly only front-end part is being deployed, so I am not able to try my video app connection (it works only locally). Could you please tell me how can I add back-end part to Surge?
server package.json
{
"name": "video-server",
"version": "1.0.0",
"description": "Web app for video conversations",
"main": "server.js",
"scripts": {
"test": "test"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.2",
"socket.io": "^4.4.1"
}
}

Deploy Node application in Heroku with ES6 modules?

I am trying to deploy my Node.js ES6 modules-based application to Heroku, it works fine locally with npm start and also when I run heroku local web but unfortunately in the deployment it throws the error attached in the screenshot.
This is how my package.json looks like.
{
"name": "",
"private": true,
"type": "module",
"engines": {
"node": "12.6.0"
},
"scripts": {
"start": "node --experimental-modules index.js",
},
"dependencies": {
...
},
"devDependencies": {
...
}
}
I have also tried by upgrading Node to 13.2.0 as suggested in this thread https://stackoverflow.com/a/59399717/5763627, but nothing changes with Heroku.

How to deploy nodejs code from local machine to google app engine

I have just started with nodejs and app engine. I am following the tutorial
https://cloud.google.com/nodejs/tutorials
1) I have created a project then cloned the nodejs-mvms-quickstart repository.
2) Opened Development/source code and opened the nodejs-mvms-quickstart/1-hello-world
3) and started the node server
npm start
This is working fine. Now I want to deploy my nodejs application from my local server without copying to github and cloning on the server.
For this I am using following command
gcloud app deploy
but this is showing following errors:
If this is your first deployment, this may take a while...done.
Beginning deployment of service [default]...
Building and pushing image for service [default]
WARNING: No node version specified. Please add your node version, see https://docs.npmjs.com/files/package.json#engines
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[C:\Users\Sunil Garg\AppData\Roaming\gcloud\logs\2017.05.07\20.38.59.221000.log]
.
Started cloud build [1cd2979e-527b-4d68-b430-31471534246e].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/1c
d2979e-527b-4d68-b430-31471534246e?project=help-coin
ERROR: gcloud crashed (error): [Errno 10054] An existing connection was forcibly
closed by the remote host
If you would like to report this issue,please run the following command:
gcloud feedback
To check gcloud for common problems,please run the following command:
gcloud info --run-diagnostics
Here is my package.json
{
"name": "myapp",
"version": "1.0.0",
"description": "myapp",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"body-parser": "^1.15.0",
"connect-timeout": "^1.8.0",
"express": "^4.13.4",
"generic-pool": "^2.4.2",
"multer": "^1.2.0",
"mysql": "^2.10.2",
"requestify": "^0.1.17"
}
}
What is the issue? Am I missing something?
Try adding the following 2 parameters to the package.json
Add the version of node your application is compatible with.
"engines": {
"node": "4.6.0"
}
since you're using npm start you might need this in the script parameter as well since npm start is calling command stated in start in script param, change app.js according your application, like node quickstart.js. Always make sure to specify the path if your package.json is in the root directory and the .js is in a sub directory as well.
"scripts": {
"start": "node app.js"
}

Specifying a start script - Node

The Node JS application is working fine using node command. (node app.js) I haven't as yet used the start / test scripts in package.json file (As a bonus: If you define scripts.start in your package.json file, you don't need a Procfile) like:
{
"name": "application-name",
"version": "0.1.0",
"description": "A Node.js app using Express 3",
"main": "app",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "3.4.0",
"ejs": "*"
},
"keywords": [
"node",
"heroku",
"express"
]
}
And I'm not getting any error but a message after issuing the command npm start
> application-name#0.1.0 start E:\nodeFileUpload
> node app.js
And then the application exits while if I issue node app.js it works fine.
I’m pretty sure that this is configuration related error but I can’t fathom out why.

Resources