Compare commits

...

10 Commits

Author SHA1 Message Date
Christian Georgi
baccf26a56 Merge pull request #190 from Oschm/openSAP-week3-unit3
Open sap week3 unit3
2021-01-26 09:22:32 +01:00
Oliver Schmidt
0d6ee73920 changed loading of fe library and usage of fe AppComponent because of changes in library structure 2021-01-25 15:20:11 +00:00
Oliver Schmidt
e3159afdc2 hardcode squlite version because version 5.0.1 cant't be installed. 2021-01-25 14:52:04 +00:00
Christian Georgi
ad9a374381 Update README.md 2020-04-20 17:10:36 +02:00
Christian Georgi
9d285805cd Add package-lock.json, fix readme 2020-04-02 15:59:21 +02:00
Matthias Bühl
2faf34d264 Merge pull request #42 from SAP-samples/comment-out-@requires
comment out @requires again CatalogService.Orders
2020-03-25 17:05:10 +01:00
johannes-vogel
1de3528b45 comment out @requires again CatalogService.Orders 2020-03-25 16:22:42 +01:00
Christian Georgi
e399b9d76e Update readme 2020-03-23 17:08:23 +01:00
Harini Gunabalan
dd30cd10f8 Update README.md 2020-03-21 23:45:53 +01:00
Harini Gunabalan
fa724d4c9c Adding codebase of OpenSAP week3 unit3 demo 2020-03-21 23:46:06 +01:00
14 changed files with 3549 additions and 417 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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": "*"

View File

@@ -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' }
})) }))

View File

@@ -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": {

View File

@@ -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' }
})) }))

View File

@@ -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": {

View File

@@ -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' }
})) }))

View File

@@ -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": {

View 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 ####
############################################################

File diff suppressed because it is too large Load Diff

View File

@@ -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?",

View File

@@ -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;
} }

View File

@@ -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