Welcome to the educational CAP on TypeScript monorepo project - Mortgage calculator.
This is an MTA application which has 2 CAP on TypeScript modules and 1 SAPUI5 on TypeScript module.
CAP modules are enforced with a shared package.
1. Install TypeScript
npm install typescript -g
npm i
Due to the monorepo structure it has to be done just once in the root folder.
cds d
All npm run
scripts have respective run configurations in in .vscode/launch.json
.
npm run start-cap-server
The @mortgagecalc/cap-server package is designed for local run of all CAP services in one Node.js instance.
npm run dev -w @mortgagecalc/approuter
Current approuter is a PoC in the PoC: it's based on non-official @sap/approuter extension: dev-approuter. This extension should be able to raise CAP and approuter hosts with one console command instead of two. But it appears that it doesn't allow to select a command to start CAP server => it can't work with TypeScript so that it's working as a regular approuter.
- cf CLI installed.
- mbt CLI installed.
- BTP subaccount with HANA DB created and started.
- cf CLI is authorized with
cf login
.
npm run deploy-all
or
mbt build
cf deploy mta_archives/mortgagecalc_1.0.0.mtar
One of these is strongly recommended for a first deploy.
npm run deploy-database
npm run deploy-calcularor-module
npm run deploy-site-module
npm run deploy-ui-module
Detailed community article with full process explanation is here.
cf ssh mortgagecalc-calculator-service
(or mortgagecalc-site-service)ps aux | pgrep node
Here you'll receive PID (e.g 254)kill -usr1 254
- In another console
cf ssh -N -L 9229:127.0.0.1:9229 mortgagecalc-calculator-service
(or mortgagecalc-site-service) - Run vscode configuration
Calculator remote debug
(orSite remote debug
)
It contains these folders and files
Workspaces | Purpose |
---|---|
database/ |
Package @mortgagecalc/database for the shared domain model and data. Important: see the build config in root folder of the project. Reason: artifacts generated by cds services must be deployed as well. |
app/ |
content for UI frontends goes here |
packages/foundation |
package @mortgagecalc/foundation contains shared cds (including i18n - for this at least an empty index.cds is required) and classes |
srv/calculator |
package @mortgagecalc/calculatorservice contains the service which is responsible for only mortgage calculations |
srv/site |
package @mortgagecalc/siteservice contains the service for the site UI |
Every CAP package has the standard structure, following CAP recommended project layout:
File or Folder | Purpose |
---|---|
app/ |
content for UI frontends goes here |
database/ |
your domain models and data go here |
srv/ |
your service models and code go here |
package.json |
project metadata and configuration |
readme.md |
this getting started guide |
Q: Any known issues to track? A: Waiting for next Typer issue to be resolved: cap-js/cds-types#136. Until then the package "@cap-js/cds-types": ">=0.6.1" must be installed manually. Also cap-js/cds-typer#271.