Skip to content

tiosteel/mortgagecalc

Repository files navigation

Description of contents:

Getting Started

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.

Installation

1. Install TypeScript
npm install typescript -g
2. Install dependencies.
npm i

Due to the monorepo structure it has to be done just once in the root folder.

3. Deploy tables / views and master data to SQLite
cds d

Run

All npm run scripts have respective run configurations in in .vscode/launch.json.

Run CAP services
npm run start-cap-server

The @mortgagecalc/cap-server package is designed for local run of all CAP services in one Node.js instance.

Run approuter
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.

Build / Deploy

Pre-requisites

  1. cf CLI installed.
  2. mbt CLI installed.
  3. BTP subaccount with HANA DB created and started.
  4. cf CLI is authorized with cf login.
Deploy all modules at once
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.

Deploy database module
npm run deploy-database
Deploy calculator CAP module
npm run deploy-calcularor-module
Deploy site CAP module
npm run deploy-site-module
Deploy UI
npm run deploy-ui-module

Remote debug

Detailed community article with full process explanation is here.

  1. cf ssh mortgagecalc-calculator-service (or mortgagecalc-site-service)
  2. ps aux | pgrep node Here you'll receive PID (e.g 254)
  3. kill -usr1 254
  4. In another console cf ssh -N -L 9229:127.0.0.1:9229 mortgagecalc-calculator-service (or mortgagecalc-site-service)
  5. Run vscode configuration Calculator remote debug (or Site remote debug)

Project structure

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

Further discussions

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published