mirror of
https://github.com/swisscom/cf-sample-app-nodejs.git
synced 2026-12-04 13:48:41 +00:00
A sample Express application to deploy to Cloud Foundry which works out of the box. | Read-only mirror of https://github.com/swisscom/cf-sample-app-nodejs — Swisscom. Issues & pull requests at the source.
- JavaScript 90.3%
- Pug 6.8%
- CSS 2.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
CF Sample App Node.js
A sample Express application to deploy to Cloud Foundry which works out of the box.
Run locally
- Install Node.js and npm
- Run
npm install - Run
npm start - Visit http://localhost:3000
Run in the cloud
- Install the cf CLI
- Run
cf push my-nodejs-app -m 128M --random-route - Visit the given URL
Tune app using environment variables
This application reads environment variables, which are rendered in the HTML view:
TITLE: page titleMESSAGE: page body
If you are running locally, set these variables before launching the app:
$ TITLE="New title" MESSAGE="I am updating environment variables" npm start
If you deployed the app to Cloud Foundry, use these commands to set environment variables:
$ cf set-env my-nodejs-app TITLE "New title"
$ cf set-env my-nodejs-app MESSAGE "I am updating environment variables"
$ cf restage my-nodejs-app