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%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-10-16 17:16:22 +02:00
src Add configurability through environment variables 2018-11-22 16:18:28 +00:00
.gitignore Update dependencies 2017-08-18 14:52:28 +02:00
CODE_OF_CONDUCT.md Compliance bulk update. Add CODE_OF_CONDUCT.md 2024-10-16 17:16:22 +02:00
CONTRIBUTING.md Compliance bulk update. Add CONTRIBUTING.md 2024-10-16 17:16:21 +02:00
LICENSE Add license file 2017-05-29 10:42:56 +02:00
package-lock.json chore(deps): bump pug from 2.0.4 to 3.0.1 2021-11-16 11:51:14 +00:00
package.json chore(deps): bump pug from 2.0.4 to 3.0.1 2021-11-16 11:51:14 +00:00
README.md Add configurability through environment variables 2018-11-22 16:18:28 +00:00

CF Sample App Node.js

A sample Express application to deploy to Cloud Foundry which works out of the box.

Run locally

  1. Install Node.js and npm
  2. Run npm install
  3. Run npm start
  4. Visit http://localhost:3000

Run in the cloud

  1. Install the cf CLI
  2. Run cf push my-nodejs-app -m 128M --random-route
  3. Visit the given URL

Tune app using environment variables

This application reads environment variables, which are rendered in the HTML view:

  • TITLE: page title
  • MESSAGE: 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