Hello World!

Let’s create a simple Hello World OData service using the SAP Cloud Application Programming Model in six lines of code and in under 2 minutes.

Define a service

… using CDS:

service say {
  function hello (to:String) returns String;

Implement it

… for example, using Node.js express.js handlers style:

module.exports = (say)=>{
  say.on ('hello', req => `Hello ${}!`)

… or Node.js es6 classes style:

module.exports = class say {
  hello(req) { return `Hello ${}!` }

Note: that has limited flexibility, for example, you can register only one handler per event.

Run it

… for example, from your command line:

cds run

Consume it

… for example, from your browser: