Your app right produces output in two different ways. On the one hand, it logs which port it is using when your app is started properly. And on the other hand, it sends a response ('Hello World') when the HTTP endpoint is accessed.

Add two more pieces of logging information. Change the server.js file accordingly:

You added two additional logging statements. The first one logs the time whenever the endpoint is accessed. The second one informs about which Node.js version is used when the web server is started.

The version of Node.js that is used by SAP Cloud Platform Cloud Foundry can differ from the one that is used locally. The package.json file doesn’t specify which engine.version (i.e. version of node ) SAP Cloud Platform Cloud Foundry should use. Therefore, SAP Cloud Platform Cloud Foundry uses a default version. Step 4 will show the logged out and the version which is actually used by Cloud Foundry. For more information about the usage of engine.version, refer to Cloud Foundry documentation.

It’s not necessary to delete a application before you re-deploy it to SAP Cloud Platform Cloud Foundry. But at some point in time it might be useful to know this command. Please be aware that the logs will also be removed when you delete an app.

To delete the app, execute the following command:

cf delete myapp

This step is not mandatory but good to know.

Verify if your application has successfully been removed by checking your application overview:

The first option is to dump recent log messages of an application to the terminal by:

cf logs myapp --recent

There you can already see what happened at the deployment process which will be helpful if something went wrong and your application couldn’t be started.

The screenshot should also show a different log output of your application as when it runs locally. The node version was implicitly set: e.g. 'myapp is using Node.js version: v6.14.3'. The port on which the application is now accessible is also different from the one on your local machine. The application takes the environment variable 'port' which is here port 8080.

The second option is to stream the logs. Unlike the dumping, streaming of logs can be helpful for special use cases like live-debugging your application. The application writes log messages when it serves web requests. Run the following command to access them ‘live’:

cf logs mayapp | grep -v RTR

Every time someone accesses the application via the according URL your terminal will print an new line. 'grep -v RTR' excludes specific logs from the so called Router. This could also be omitted and is only for demonstration purposes.