Files
cloud-cap-samples/chinook
2021-01-04 17:03:58 +01:00
..
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 14:37:01 +01:00
2021-01-04 17:03:58 +01:00
2021-01-04 17:03:58 +01:00
2021-01-04 17:03:58 +01:00

Getting Started

Welcome to your new project.

It contains these folders and files, following our recommended project layout:

File or Folder Purpose
app/ will contain compiled front bundles
app/front/ contains frontend app on react
app/deployers/ contains deployment stuff
db/ your domain models and data go here
srv/ your service models and code go here
test/ your services tests
package.json project metadata and configuration
mta.yaml deployment config
readme.md this getting started guide
server.js initial server set up

Development

  • Start cds service on 4004 port in watch mode:
cds watch
  • Open app/front folder and run next commands. This will install dependencies and run frontend src files watcher. When you will change src files your bundles in app directory will re-compiled. Now you can enjoy development:
npm install
npm run watch

For better frontend development experience use below command instead of watcher. This will start frontend dev server on 3000 port. Now your bundles will be hot reloaded, this means you do not need reload the page to see changes:

npm run start

Test

  • Change package.json db section
  "db": {
    "kind": "sql"
  }
  • Run tests
npm run test

Deployment

  • Make sure you already have hana trial instance in your cockpit dashboard (SAP Cloud Platform). Or if you are using hana instance - change it in mta.yaml config file from hanatrial to hana
  • Change package.json db section
  "db": {
    "kind": "hana"
  }
  • Authenticate to the Cloud Foundry:
cf login
  • Open app/front folder and run the following commands. This will create frontend production bundles in app subfolder:
npm install
npm run build:prod
  • Clean up app/deployers/html5Deployer/resources folder from the previous frontend build

  • From root directory run:

mbt build -t ./
cf deploy media-store_1.0.0.mtar
  • Now your services should be deployed with hanatrial instance and filled with initial data

Learn More