GithubHelp home page GithubHelp logo

isabella232 / hazelcast-nodejs-client-pcf-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hazelcast/hazelcast-nodejs-client-pcf-sample

0.0 0.0 0.0 1.61 MB

Hazelcast Node.js Client Sample App deployed to PCF Environment

JavaScript 2.59% CSS 3.65% HTML 93.75%

hazelcast-nodejs-client-pcf-sample's Introduction

Hazelcast Node.js Client PCF Sample App

This sample app is based on the Pivotal Cloud Node.js Sample App at https://github.com/cloudfoundry-samples/cf-sample-app-nodejs

$ cf push

(See https://docs.cloudfoundry.org/buildpacks/node/node-tips.html)

After that, bind an existing Hazelcast service (e.g.,hcmc1) to the app and restart it.

$ cf bs cf-nodejs hzmc1
$ cf restage cf-nodejs
Restaging app cf-nodejs in org system / space system as admin...

Staging app and tracing logs...
...

Waiting for app to start...

name:              cf-nodejs
requested state:   started
instances:         1/1
usage:             512M x 1 instances
routes:            cf-nodejs-toadish-decolonisation.cfapps.example.com
last uploaded:     Fri 22 Dec 12:48:02 CET 2017
stack:             cflinuxfs2
buildpack:         node.js 1.6.4 (no decorators apply)
start command:     npm start

     state     since                  cpu    memory          disk          details
#0   running   2017-12-28T10:49:40Z   0.1%   37.6M of 512M   80.2M of 1G 
We confirmed that it was started correctly and noticed the route assigned to it, which is `cf-nodejs-toadish-decolonisation.cfapps.example.com`.

Take note of the route assigned to it, for example cf-nodejs-toadish-decolonisation.cfapps.example.com. You can test put and get operations with curl.

First a put operation for a new key, returning null as expected.
$ curl -v 'http://cf-nodejs-toadish-decolonisation.cfapps.example.com/put?key=testKey1&value=testValue1'
*   Trying 35.186.234.125...
* TCP_NODELAY set
* Connected to cf-nodejs-toadish-decolonisation.cfapps.example.com (35.186.234.125) port 80 (#0)
> GET /put?key=testKey1&value=testValue1 HTTP/1.1
> Host: cf-nodejs-toadish-decolonisation.cfapps.example.com
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 4
< Content-Type: application/json; charset=utf-8
< Date: Thu, 28 Dec 2017 10:58:02 GMT
< Etag: W/"4-K+iMpCQsduglOsYkdIUQZQMtaDM"
< X-Powered-By: Express
< X-Vcap-Request-Id: 474f9742-2c1c-47d9-5ee4-1399b30cb527
< Via: 1.1 google
< 
* Connection #0 to host cf-nodejs-toadish-decolonisation.cfapps.example.com left intact
null
Then a get for that same key, returning the test value that we expected.
$ curl -v  'http://cf-nodejs-toadish-decolonisation.cfapps.example.com/get?key=testKey1'
*   Trying 35.186.234.125...
* TCP_NODELAY set
* Connected to cf-nodejs-toadish-decolonisation.cfapps.example.com (35.186.234.125) port 80 (#0)
> GET /get?key=testKey1 HTTP/1.1
> Host: cf-nodejs-toadish-decolonisation.cfapps.example.com
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 11
< Content-Type: application/json; charset=utf-8
< Date: Thu, 28 Dec 2017 11:01:23 GMT
< Etag: W/"b-tLvHxCJXky/5rwaD7k1YLFxaa60"
< X-Powered-By: Express
< X-Vcap-Request-Id: 362211eb-c5e5-49b0-53ce-332bb41fcb62
< Via: 1.1 google
< 
* Connection #0 to host cf-nodejs-toadish-decolonisation.cfapps.example.com left intact
"testValue1"

hazelcast-nodejs-client-pcf-sample's People

Contributors

googlielmo avatar mpivotal 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.