cds build/all --clean && mbt build -p=cf
############## RESOURCES ##################################
resources:
- name: school-db-hdi-container
parameters:
service: hanatrial
service-plan: hdi-shared
type: com.sap.xs.hdi-container
properties:
hdi-container-name: ${service-name}
### XSUAA service instance
- name: school-xsuaa
parameters:
path: ./xs-security.json
service: xsuaa
service-plan: application
service-keys:
- name: school-xsuaa-key
type: com.sap.xs.uaa
############################################################
#### App Router used to authentication
- name: school-app-router
type: nodejs
path: app
build-parameters:
ignore: ["node_modules/"]
parameters:
disk-quota: 256M
memory: 256M
requires:
- name: school-xsuaa
- name: srv_api
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: srv_api
url: ~{url}
#### The SRV Module is the backend of application, It will be started
- name: school-srv
type: nodejs
path: srv
build-parameters:
ignore: ["node_modules/"]
parameters:
memory: 256M
disk-quota: 256M
provides:
- name: srv_api
properties:
url: ${default-url}
requires:
- name: school-db-hdi-container
- name: school-xsuaa
{
"authenticationMethod":"route",
"routes": [
{
"source": "^/(.*)$",
"target": "$1",
"authenticationType": "xsuaa",
"destination": "srv_api",
"csrfProtection": false
}
]
}
service AdminService @(requires:'admin'){
cds compile srv/ --to xsuaa > .xs-security.json
{
"xsappname": "school",
"tenant-mode": "dedicated",
"scopes": [
{
"name": "$XSAPPNAME.admin",
"description": "admin"
}
],
"attributes": [],
"role-templates": [
{
"name": "admin",
"description": "generated",
"scope-references": [
"$XSAPPNAME.admin"
],
"attribute-references": []
}
]
}
npm install --save passport @sap/xssec @sap/xsenv
{
"name": "school-srv",
"description": "Generated from ../package.json, do not change!",
"version": "1.0.0",
"dependencies": {
"@sap/cds": "^3.21.2",
"@sap/xsenv": "^2.2.0",
"@sap/xssec": "^2.2.5",
"express": "^4.17.1",
"hdb": "^0.17.1",
"passport": "^0.4.1"
},
"engines": {
"node": "^8.9",
"npm": "^6"
},
"devDependencies": {},
"scripts": {
"postinstall": "npm dedupe && node .build.js",
"start": "node ./node_modules/@sap/cds/bin/cds.js serve gen/csn.json",
"watch": "nodemon -w . -i node_modules/**,.git/** -e cds -x npm run build"
},
"cds": {
"requires": {
"db": {
"kind": "hana",
"model": "gen/csn.json"
}
},
"auth": {
"passport": {
"strategy": "JWT"
}
}
}
}
{
"name": "school",
"version": "1.0.0",
"description": "A project to pratice and study more about SAP Cloud Application Programming Model. ",
"repository": "https://github.com/balbinosoares/school-cap.git",
"license": "Apache-2.0",
"dependencies": {
"@sap/cds": "^3.21.x",
"@sap/hana-client": "^2.4.182",
"@sap/xsenv": "^2.2.0",
"@sap/xssec": "^2.2.5",
"express": "^4.17.1",
"hdb": "^0.17.1",
"passport": "^0.4.1"
},
{
"name": "approuter",
"dependencies": {
"@sap/approuter": "latest"
},
"scripts": {
"start": "node app.js"
}
}
{
"authenticationMethod":"route",
"routes": [
{
"source": "^/(.*)$",
"target": "$1",
"authenticationType": "xsuaa",
"destination": "srv_api",
"csrfProtection": false
}
]
}
ID: school
_schema-version: "2.1"
version: 0.0.1
parameters:
enable-parallel-deployments: true
############## MODULES ##################################
modules:
#### We can see that module name DB is created as application, it will be in a stopped state most of the time, it is used only during deployment for HDB modules.
- name: school-db
type: hdb
path: db
build-parameters:
ignore: ["node_modules/"]
parameters:
memory: 256M
disk-quota: 256M
requires:
- name: school-db-hdi-container
#### The SRV Module is the backend of application, It will be started
- name: school-srv
type: nodejs
path: srv
build-parameters:
ignore: ["node_modules/"]
parameters:
memory: 256M
disk-quota: 256M
provides:
- name: srv_api
properties:
url: ${default-url}
requires:
- name: school-db-hdi-container
- name: school-xsuaa
#### App Router used to authentication
- name: school-app-router
type: nodejs
path: app
build-parameters:
ignore: ["node_modules/"]
parameters:
disk-quota: 256M
memory: 256M
requires:
- name: school-xsuaa
- name: srv_api
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: srv_api
url: ~{url}
############## RESOURCES ##################################
resources:
- name: school-db-hdi-container
parameters:
service: hanatrial
service-plan: hdi-shared
type: com.sap.xs.hdi-container
properties:
hdi-container-name: ${service-name}
### XSUAA service instance
- name: school-xsuaa
parameters:
path: ./xs-security.json
service: xsuaa
service-plan: application
service-keys:
- name: school-xsuaa-key
type: com.sap.xs.uaa
############################################################
cds build/all --clean && mbt build -p=cf"
cf deploy mta_archives/school_0.0.1.mtar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |