Git Product home page Git Product logo

hello.js's Introduction

This very simple node.js app is in a state where, in a few commands, we can demonstrate connecting to a MySQL server that we can specify.

$ git clone https://github.com/todd-hepler-ctl/hello.js.git
$ cd hello.js
$ cf login $YOUR_CF_ENDPOINT
[...]
$ cf push # push the app up for the first time
[...]
$ # now create a "service" for your database that is outside your cloud foundry cluster
$ cf create-user-provided-service dbas-mysql-db -p "host, port, user, password, database"

host> todd-mysql.uc1.rdbs.ctl.io

port> 49247

user> admin

password> not-a-real-password

database> foo
Creating user provided service dbas-mysql-db in org DemoSE8 / space development as appsadmin...
OK
$ cf services # to see your newly created user provided service
$ # bind the service to your hello.js app
$ cf bind-service hello.js dbas-mysql-db
Binding service dbas-mysql-db to app hello.js in org DemoSE8 / space development as appsadmin...
OK
TIP: Use 'cf restage hello.js' to ensure your env variable changes take effect
$ cf restage hello.js

Inside server.js, the credentials that you specified for your dbas-mysql-db user provide service are parsed from the VCAP_SERVICES environment variable and then used to connect to that database and retrieve a value.

hello.js's People

Contributors

todd-hepler-ctl avatar

Watchers

 avatar

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.