2.4 KiB
2.4 KiB
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-src/ |
Contains frontend app on react |
deployers/ |
Contains deployment staff |
db/ |
your domain models and data go here |
srv/ |
your service models and code go here |
test/ |
your service tests |
package.json |
project metadata and configuration |
mta.yaml |
deployment config |
readme.md |
this getting started guide |
server.js |
initial servers set up |
Start development steps
- At first open a new terminal and run
npm run deploy. It should create new sqlite source and fill initial data fromdb/data. You can browse database in any sqlite client - Run
cds watch. This will start cds service on 4004 port in watch mode - Open
app-srcfolder and runnpm installandnpm run watch. This will install dependencies and run frontend src files watcher. When you will change src files your bundles in app folder will re-compiled. Now you can enjoy development
Better dev experience
- You can use webpack-dev-server to rapid frontend development. Instead of running watcher in
app-srcdonpm run start. 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
Deployment steps
- Make sure you already have hanatrial 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
- Replace
"kind": "sql"with"kind": "hana"in package.json require section - Run
cf loginfor Cloud Foundry authentication - Open
app-srcfolder and runnpm installif you are haven't done this andnpm run build. This will create frontend production bundles in app subfolder - Run
mbt build -t ./. This will create new build in*.mtarfile - Run
cf deploy <.mtar file># for example, media-store_1.0.0.mtar - Now your services should be deployed with hanatrial instance and filled with initial data
Learn More
Learn more at https://cap.cloud.sap/docs/get-started/.