|
Important
|
While you can run and interact with this example application on localhost, it requires that you also have a cache server installed and configured. This example application runs best when deployed on OpenShift with a JBoss Data Grid cache server. For more details on using this example application with a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the Node.js Runtime Guide. |
|
Important
|
This example application requires Node.js 8.x or greater and npm 5 or greater.
|
|
Important
|
As part of the process of creating this example application using developers.redhat.com/launch or the Fabric8 Launcher tool, set up a project with a CI/CD deployment of this example application. You can see the status of this deployment in your Single-node OpenShift Cluster or OpenShift Online Web Console. |
If you have a single-node OpenShift cluster, such as Minishift or Red Hat Container Development Kit, installed and running, you can also deploy your example application there. A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
To deploy your example application to a running single-node OpenShift cluster:
-
Navigate to the root directory of your example application.
$ git clone [email protected]:bnair2001/dash $ cd dash
-
Log in and create your project.
$ oc login -u developer -p developer $ oc new-project MY_PROJECT_NAME
-
Deploy the cache service.
$ oc create -f service.cache.yml
-
Deploy your example application.
$ ./start-openshift.sh
-
Determine the URL of the
greetingservice.$ oc get route ${value-name-app} -o jsonpath={$.spec.host} ${value-name-app}-MY_PROJECT_NAME.LOCAL_OPENSHIFT_HOSTNAME
-
Navigate to the
greetingservice using your browser. -
Click Invoke the service once.
Notice the
durationvalue is above2000. Also notice the cache state has changed formNo cached valuetoA value is cached. -
Wait 5 seconds and notice cache state has changed back to
No cached value.The TTL for the cached value is set to 5 seconds. Once the TTL expires, the value is no longer cached.
-
Click Invoke the service once more to cache the value.
-
Click Invoke the service a few more times over the course of a few seconds while cache state is
A value is cached.Notice a significantly lower
durationvalue since it is using a cached value. If you click Clear the cache, the cache is emptied.
You can learn more about this example application and the Node.js runtime in the Node.js Runtime Guide.