GithubHelp home page GithubHelp logo

ibm-cloud / get-started-node Goto Github PK

View Code? Open in Web Editor NEW
78.0 25.0 238.0 445 KB

Sample and tutorial to help you get started with Express, REST API and a database.

Home Page: https://cloud.ibm.com/docs/runtimes/nodejs?topic=Nodejs-getting-started

License: Apache License 2.0

JavaScript 90.25% HTML 8.89% CSS 0.49% Dockerfile 0.37%

get-started-node's Introduction

Node.js getting started application

The Getting Started tutorial for Node.js uses this sample application to provide you with a sample workflow for working with any Node.js app on IBM Cloud or in IBM Cloud Private; you set up a development environment, deploy an app locally and on the cloud, and then integrate a IBM Cloud database service in your app.

The Node.js app uses Express Framework and Cloudant noSQL DB service or the MongoDB Service to add information to a database and then return information from a database to the UI. To learn more about how the app connects to Cloudant, see the Cloudant library for Node.js.

Gif of the sample app contains a title that says, Welcome, a prompt asking the user to enter their name, and a list of the database contents which are the names Joe, Jane, and Bob. The user enters the name, Mary and the screen refreshes to display, Hello, Mary, I've added you to the database. The database contents listed are now Mary, Joe, Jane, and Bob.

Before you begin

You'll need a IBM Cloud account, Git, Cloud Foundry CLI, and Node installed. If you use IBM Cloud Private, you need access to the IBM Cloud Private Cloud Foundry environment.

Instructions

IBM Cloud Cloud Foundry: Getting started tutorial for Node.js.

IBM Cloud Kubernetes Service: Deploy to IBM Cloud Kubernetes Service

Red Hat OpenShift on IBM Cloud: Deploy to Red Hat OpenShift on IBM Cloud

IBM Cloud Private: The starter application for IBM Cloud Private guides you through a similar process. However, instead of hosting both your service and application in the same cloud environment, you use a user-provided service. This guide shows you how to deploy your application to IBM Cloud Private and bind it to a Cloudant Database in IBM Cloud. For the complete procedure, see Working with user-provided services and the Node.js starter app.

get-started-node's People

Contributors

akihikokuroda avatar atrieder avatar cdmauney avatar cswanson2 avatar dependabot[bot] avatar henrynash avatar hickeyma avatar kevin-ortega avatar opiethehokie avatar preetisawant avatar rmahesh45 avatar rvennam avatar rvennam987 avatar rxu1 avatar univ0298 avatar upkarlidder avatar zzdrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

get-started-node's Issues

OpenSift cleanup steps needs update

The OpenShift deployment Cleanup steps needs to be updated to remove the following resources:

service/get-started-node
buildconfig.build.openshift.io/get-started-node
build.build.openshift.io/get-started-node-1
imagestream.image.openshift.io/get-started-node

Link broken for "Learn More"

I the Readme.md third point:
3. Prepare the app for deployment

The manifest.yml includes basic information about your app, such as the name, how much memory to allocate for each instance and the route. In this manifest.yml random-route: true generates a random route for your app to prevent your route from colliding with others. You can replace random-route: true with host: myChosenHostName, supplying a host name of your choice. Learn more...

applications:

  • name: nodejs-helloworld
    random-route: true
    memory: 128M

The "Learn more." link points to https://github.com/IBM-Bluemix/get-started-node/blob/master/docs/manageapps/depapps.html#appmanifest which gives 404 error.

found 6 vulnerabilities in this example

~/tmp/IBM-Cloud/get-started-node$ npm install
added 142 packages from 168 contributors and audited 404 packages in 2.91s
found 6 vulnerabilities (3 moderate, 3 high)
run npm audit fix to fix them, or npm audit for details

Pod in Error STATUS

Hi,

After going trough the deployment steps my pod does not get out of error status. From the logs I see that is complains about the Cloudant function. I've run npm install and npm run on my local machine and didn't got the same error.

Gonne trough Cloudant steps and everything seems ok. Any ideas on how to fix it?

$ kubectl logs get-started-node-c689d597d-5btz9                                                                         
> [email protected] start /app
> node server.js

/app/server.js:170
  cloudant = Cloudant(process.env.CLOUDANT_URL);
             ^

TypeError: Cloudant is not a function
    at Object.<anonymous> (/app/server.js:170:14)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:160:9)
    at bootstrap_node.js:507:3

npm ERR! Linux 4.4.0-148-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the get-started-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs get-started-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls get-started-node
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /app/npm-debug.log

Error when running `npm start`

I followed the steps in the README to clone the repo and install the dependencies. When I run npm start, I get the following error log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/anthony/Development/Test/get-started-node/node_modules/.bin:/Users/anthony/.swiftenv/shims:/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:/Users/anthony/Development/SDK/android-sdk-macosx/platform-tools/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin
10 verbose lifecycle [email protected]~start: CWD: /Users/anthony/Development/Test/get-started-node
11 silly lifecycle [email protected]~start: Args: [ '-c', 'node server.js' ]
12 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `node server.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:194:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:194:7)
14 verbose stack     at maybeClose (internal/child_process.js:899:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/anthony/Development/Test/get-started-node
17 verbose Darwin 16.5.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 verbose node v7.10.0
20 verbose npm  v4.5.0
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] start: `node server.js`
23 error Exit status 1
24 error Failed at the [email protected] start script 'node server.js'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the get-started-node package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     node server.js
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs get-started-node
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls get-started-node
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]

I updated node and npm versions to the latest, as suggested in the logs, but I got the same result.

Line 5 should be corrected in the source.

The README.md for this example states:

In the root directory, update line 5 of server.js to look up the environment variable

var port = process.env.VCAP_APP_PORT || 8080;

However, this should probably be fixed in the source code for the sample itself. At the moment, this is an extra hurdle to get it working out of the box. Because the || is in place, this will still work locally with Node.JS anyway.

Link giving instruction is broken

This link is broken -> Getting started tutorial for Node.js.
Also, nobody seems to knows at IBM Cloud support how to setup https... so would be nice to have the instructions somewhere.

"None of the buildpacks detected a compatible application

Updating app vy301-726-nodesample...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
66.14 KiB / 66.14 KiB [=======================================================================] 100.00% 1s

Waiting for API to complete processing files...

Stopping app...

Staging app and tracing logs...
Downloaded build artifacts cache (22.6M)
None of the buildpacks detected a compatible application
Exit status 222
Cell ba487ff3-17a3-4b6d-ae39-07960f368a2a stopping instance 5636cd6e-9d72-4b07-8a04-8018ce21e7ba
Cell ba487ff3-17a3-4b6d-ae39-07960f368a2a destroying container for instance 5636cd6e-9d72-4b07-8a04-8018ce21e7ba
Error staging application: An app was not successfully detected by any available buildpack

TIP: Use 'cf.exe buildpacks' to see a list of supported buildpacks.
FAILED

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.