Skip to content
This repository was archived by the owner on Nov 13, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion FRI.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,34 @@ This document describes issues that have been encountered during previous instan

### EACCES permissions errors

Did you encounter a error during the installation of global node module (with the `npm install -g` command)?
Did you encounter the following error during the installation of global node module (with the `npm install -g` command)?
```
user:~/bookshop$ npm i -g @sap/cds-dk

npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2019-11-25T12_55_47_445Z-debug.log
```

**Solution**

Expand Down
12 changes: 9 additions & 3 deletions exercises/05/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ If you want to create the Orders entities using the command line with `curl`, he

:point_right: Order 5 copies of Wuthering Heights (no order ID specified):

```shell
```sh
curl \
-d '{"book_ID":201,"quantity":5}' \
-H 'Content-Type: application/json' \
Expand All @@ -214,7 +214,7 @@ curl \

For Windows users, this is the equivalent command (basically you have to use double quotes throughout, and therefore some must be escaped with `\`, and the line continuation character is `^` rather than `\`):

```
```sh
curl ^
-d "{\"book_ID\":201,\"quantity\":5}" ^
-H "Content-Type: application/json" ^
Expand All @@ -223,11 +223,17 @@ curl ^

:point_right: Order 9 copies of Life, The Universe And Everything (specifying an order ID):

```
```sh
curl \
-d '{"ID": "527ef85a-aef2-464b-89f6-6a3ce64f2e14", "book_ID":427,"quantity":9}' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Orders

# For Windows users:
curl ^
-d "{\"ID\": \"527ef85a-aef2-464b-89f6-6a3ce64f2e14\", \"book_ID\":427,\"quantity\":9}" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Orders
```

<a name="postman"></a>**Using Postman**
Expand Down
27 changes: 25 additions & 2 deletions exercises/06/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,32 @@ If you want to use `curl` on the command line instead of Postman, use the follow

First, add the author "Iain M Banks":

```
```sh
curl \
-d '{"ID": 162, "name": "Iain M Banks"}' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Authors

# For Windows users:
curl ^
-d "{\"ID\": 162, \"name\": \"Iain M Banks\"}" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Authors
```

Now add the book "Consider Phlebas":

```
```sh
curl \
-d '{"ID": 44138, "title": "Consider Phlebas", "stock": 541, "author_ID": 162 }' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Books

# For Windows users:
curl ^
-d "{\"ID\": 44138, \"title\": \"Consider Phlebas\", \"stock\": 541, \"author_ID\": 162 }" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Books
```

Check that the creation requests are successful, and that you can see the new author and book in an OData Query operation: <http://localhost:4004/catalog/Authors?$expand=books>.
Expand Down Expand Up @@ -89,6 +101,12 @@ curl \
-d '{"ID": 47110, "title": "The Player of Games", "stock": 405, "author_ID": 162 }' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Books

# For Windows users:
curl ^
-d "{\"ID\": 47110, \"title\": \"The Player of Games\", \"stock\": 405, \"author_ID\": 162 }" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Books
```

The request is an OData Create request for a new book. You should see that this request is rejected with HTTP status code 405 "Method Not Allowed", with an error like this supplied in the response body:
Expand All @@ -114,6 +132,11 @@ You should also see a line in the terminal (where you invoked `cds serve all`) l
curl \
-X DELETE \
'http://localhost:4004/catalog/Books(251)'

# For Windows users:
curl ^
-X DELETE ^
"http://localhost:4004/catalog/Books(251)"
```

It should also fail in a similar way.
Expand Down
18 changes: 18 additions & 0 deletions exercises/07/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ curl \
-d '{"book_ID":201,"quantity":2}' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Orders

# For Windows users:
curl ^
-d "{\"book_ID\": 201, \"quantity\": 2}" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Orders
```

Order 7 copies of Eleonora:
Expand All @@ -74,6 +80,12 @@ curl \
-d '{"book_ID":252,"quantity":7}' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Orders

# For Windows users:
curl ^
-d "{\"book_ID\": 252, \"quantity\": 7}" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Authors
```

Order 42 copies of The Hitch Hiker's Guide To The Galaxy (obviously!):
Expand All @@ -83,6 +95,12 @@ curl \
-d '{"book_ID":421,"quantity":42}' \
-H 'Content-Type: application/json' \
http://localhost:4004/catalog/Orders

# For Windows users:
curl ^
-d "{\"book_ID\": 421, \"quantity\": 42}" ^
-H "Content-Type: application/json" ^
http://localhost:4004/catalog/Authors
```

Now it's time to take a look at what the service will show us for these orders. We know we can't look at the `Orders` entityset as it has a `@insertonly` annotation shortcut based restriction, so we turn to our new service `Stats`.
Expand Down
7 changes: 6 additions & 1 deletion prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ Execute the following command in this recently opened command prompt to install

Use Chocolatey to install Node.js Long Term Support (LTS) version, SQLite, make, curl (command-line client for URLs), jq (lightweight and flexible command-line JSON processor), Cloud Foundry command line interface (CLI) and the Microsoft Build Tools:
```bash
choco install -y nodejs-lts sqlite make curl jq cloudfoundry-cli microsoft-build-tools
choco install -y nodejs-lts sqlite make curl jq cloudfoundry-cli
```

Install Windows Build Tools:
```bash
npm install --global windows-build-tools
```

Next, use the Cloud Foundry CLI to install a plugin to deploy your MultiTarget Application (MTA) to Cloud Foundry:
```bash
Expand Down