Compare commits
10 Commits
openSAP-we
...
openSAP-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baccf26a56 | ||
|
|
0d6ee73920 | ||
|
|
e3159afdc2 | ||
|
|
ad9a374381 | ||
|
|
9d285805cd | ||
|
|
2faf34d264 | ||
|
|
1de3528b45 | ||
|
|
e399b9d76e | ||
|
|
dd30cd10f8 | ||
|
|
fa724d4c9c |
77
README.md
77
README.md
@@ -1,71 +1,42 @@
|
|||||||
# cloud-cap-samples
|
# Welcome to SAP Cloud Application Programming model samples
|
||||||
|
|
||||||
This is a monorepository for sample projects on [SAP Cloud Application Programming Model](https://cap.cloud.sap).
|
Find here the samples for the openSAP course [Building Applications with the SAP Cloud Application Programming Model](https://open.sap.com/courses/cp7).
|
||||||
|
|
||||||
## Description
|
## Get Access to SAP Business Application Studio
|
||||||
|
The recommended environment for the course is SAP Business Application Studio. Watch [unit 2 of week 1](https://open.sap.com/courses/cp7/items/51pzQUzbXHr2kdbOmVs6jI) for how to get access.
|
||||||
|
|
||||||
This repository provides a list of samples and reusable packages created based on SAP Cloud Application Programming Model.
|
## Setup
|
||||||
The SAP Cloud Application Programming Model enables you to quickly create business applications by allowing you to focus on your domain logic. It offers a consistent end-to-end programming model that includes languages, libraries and APIs tailored for full-stack development on SAP Cloud Platform.
|
|
||||||
|
|
||||||
The samples provided can be run in a local setup on SQLite Database.
|
In SAP Business Application Studio, open a terminal.
|
||||||
|
Then clone the repo with this specific branch:
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
* [Node.js](https://nodejs.org/en/) v8 or higher
|
|
||||||
* [Git](https://git-scm.com)
|
|
||||||
* [SQLite DB](https://www.sqlite.org/download.html) (Windows only; pre-installed on Mac/Linux)
|
|
||||||
|
|
||||||
#### Optional (if you want to import the code into an editor)
|
|
||||||
* [VS Code](https://code.visualstudio.com)
|
|
||||||
* [Add CDS extension to VS](https://cap.cloud.sap/docs/get-started/in-vscode#add-cds-editor)
|
|
||||||
|
|
||||||
## Download and Installation
|
|
||||||
|
|
||||||
#### Install `cds` development kit
|
|
||||||
```sh
|
```sh
|
||||||
# `@sap`-scoped packages are set via .npmrc
|
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week3-unit3
|
||||||
npm install -g @sap/cds-dk
|
cd projects/cloud-cap-samples
|
||||||
cds #> test-run it
|
|
||||||
```
|
```
|
||||||
Got issues? Check out the [documentation](https://cap.cloud.sap/docs/get-started/).
|
|
||||||
|
|
||||||
#### Clone and build the application
|
In the `cloud-cap-samples` folder run:
|
||||||
`git clone https://github.com/SAP-samples/cloud-cap-samples samples && cd samples && npm i`
|
```sh
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
#### Run the samples
|
## Run
|
||||||
|
|
||||||
With that you're ready to run the samples, e.g. start the [_bookshop_](./packages/bookshop) sample as follows:
|
Now you're ready to run the samples, for example:
|
||||||
|
```sh
|
||||||
|
cd packages/bookshop
|
||||||
|
cds watch
|
||||||
|
```
|
||||||
|
|
||||||
`npm run bookshop`
|
After that, watch out for the little popup in the lower right corner of SAP Business Application Studio that asks you to open the application in your browser.
|
||||||
|
|
||||||
## Test
|
|
||||||
|
|
||||||
For example, try these links in your browser:
|
|
||||||
- <http://localhost:4004> to test with generic index page.
|
|
||||||
- <http://localhost:4004/fiori.html> to test with Fiori sandbox.
|
|
||||||
|
|
||||||
|
|
||||||
## Debug
|
## Get Support
|
||||||
|
|
||||||
For example, in [VS Code](https://code.visualstudio.com) switch to _Debug_ view and launch one of the prepared _cds run_ launch configurations.
|
Check out the cap docs at https://cap.cloud.sap. <br>
|
||||||
|
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
|
||||||
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## Known Issues
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## How to obtain support
|
|
||||||
|
|
||||||
Check out the documentation on https://cap.cloud.sap. In case you find a bug, or you need additional support, please open an issue [here](https://github.com/SAP-samples/cloud-cap-samples/issues/new) in GitHub.
|
|
||||||
|
|
||||||
## To-Do (upcoming changes)
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under SAP Sample Code License Agreement, except as noted otherwise in the [LICENSE](/LICENSE) file.
|
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under SAP Sample Code License Agreement, except as noted otherwise in the [LICENSE](/LICENSE) file.
|
||||||
|
|||||||
2064
package-lock.json
generated
Normal file
2064
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,13 +11,12 @@
|
|||||||
"bookshop": "cds watch packages/bookshop",
|
"bookshop": "cds watch packages/bookshop",
|
||||||
"bookshop-enhanced": "cds watch packages/bookshop-enhanced",
|
"bookshop-enhanced": "cds watch packages/bookshop-enhanced",
|
||||||
"reviews-service": "cds watch packages/reviews-service",
|
"reviews-service": "cds watch packages/reviews-service",
|
||||||
|
|
||||||
"bookstore": "cds watch packages/bookstore",
|
"bookstore": "cds watch packages/bookstore",
|
||||||
"media-server": "cds watch packages/media-server"
|
"media-server": "cds watch packages/media-server"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "latest",
|
"@sap/cds": "^3",
|
||||||
"express": "*"
|
"express": "^4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"sqlite3": "*"
|
"sqlite3": "*"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("admin.Component", {
|
sap.ui.define(["sap/fe/core/AppComponent"], ac => ac.extend("admin.Component", {
|
||||||
metadata:{ manifest:'json' }
|
metadata:{ manifest:'json' }
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe": {}
|
"sap.fe.core": {},
|
||||||
|
"sap.fe.macros": {},
|
||||||
|
"sap.fe.templates": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"models": {
|
"models": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("bookshop.Component", {
|
sap.ui.define(["sap/fe/core/AppComponent"], ac => ac.extend("bookshop.Component", {
|
||||||
metadata:{ manifest:'json' }
|
metadata:{ manifest:'json' }
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe": {}
|
"sap.fe.core": {},
|
||||||
|
"sap.fe.macros": {},
|
||||||
|
"sap.fe.templates": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"models": {
|
"models": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
sap.ui.define(["sap/fe/AppComponent"], ac => ac.extend("orders.Component", {
|
sap.ui.define(["sap/fe/core/AppComponent"], ac => ac.extend("orders.Component", {
|
||||||
metadata:{ manifest:'json' }
|
metadata:{ manifest:'json' }
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe": {}
|
"sap.fe.core": {},
|
||||||
|
"sap.fe.macros": {},
|
||||||
|
"sap.fe.templates": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"models": {
|
"models": {
|
||||||
|
|||||||
44
packages/bookshop/mta.yaml
Normal file
44
packages/bookshop/mta.yaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
####### Generated mta.yaml based on template version 0.2.0
|
||||||
|
####### appName = capire-bookshop
|
||||||
|
####### language=nodejs; multiTenant=false
|
||||||
|
####### approuter=
|
||||||
|
|
||||||
|
_schema-version: '3.1'
|
||||||
|
ID: sap.capire-bookshop
|
||||||
|
version: 1.0.0
|
||||||
|
description: "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages."
|
||||||
|
|
||||||
|
build-parameters:
|
||||||
|
before-all:
|
||||||
|
- builder: custom
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- cds build/all
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
enable-parallel-deployments: true
|
||||||
|
|
||||||
|
modules:
|
||||||
|
############## SERVER MODULE ##########################
|
||||||
|
- name: capire-bookshop-srv
|
||||||
|
type: nodejs
|
||||||
|
path: gen/srv
|
||||||
|
properties:
|
||||||
|
EXIT: 1 # required by deploy.js task to terminate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
############## SIDECAR MODULE #########################
|
||||||
|
- name: db
|
||||||
|
|
||||||
|
type: hdb
|
||||||
|
path: gen/db
|
||||||
|
parameters:
|
||||||
|
app-name: capire-bookshop-db
|
||||||
|
requires:
|
||||||
|
#### Hana and xsuaa resources extracted from CAP configuration ####
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
|
||||||
1726
packages/bookshop/package-lock.json
generated
1726
packages/bookshop/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,9 @@
|
|||||||
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
|
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
|
||||||
"license": "SAP SAMPLE CODE LICENSE",
|
"license": "SAP SAMPLE CODE LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "latest",
|
"@sap/cds": "^3",
|
||||||
"express": "*"
|
"express": "^4",
|
||||||
|
"sqlite3": "^5.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cds run --in-memory?",
|
"start": "cds run --in-memory?",
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ service CatalogService {
|
|||||||
@requires_: 'authenticated-user'
|
@requires_: 'authenticated-user'
|
||||||
@insertonly entity Orders as projection on my.Orders;
|
@insertonly entity Orders as projection on my.Orders;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
### Service Document
|
|
||||||
GET http://localhost:4004/admin/Authors
|
|
||||||
|
|
||||||
### Create Author
|
|
||||||
POST http://localhost:4004/admin/Authors HTTP/1.1
|
|
||||||
content-Type: application/json
|
|
||||||
|
|
||||||
{
|
|
||||||
"ID": 105,
|
|
||||||
"name": "J.K. Rowling",
|
|
||||||
"dateOfBirth": null,
|
|
||||||
"dateOfDeath": null,
|
|
||||||
"placeOfBirth": "",
|
|
||||||
"placeOfDeath": ""
|
|
||||||
}
|
|
||||||
### Update Author
|
|
||||||
PATCH http://localhost:4004/admin/Authors/105 HTTP/1.1
|
|
||||||
content-Type: application/json
|
|
||||||
|
|
||||||
{
|
|
||||||
"placeOfBirth": "United Kingdom"
|
|
||||||
}
|
|
||||||
|
|
||||||
### Delete Author
|
|
||||||
DELETE http://localhost:4004/admin/Authors/105 HTTP/1.1
|
|
||||||
Reference in New Issue
Block a user