From 8b9f331733a5dee6cb6acd8fc418be1b9add1acb Mon Sep 17 00:00:00 2001 From: D070615 Date: Fri, 29 Sep 2023 16:40:47 +0200 Subject: [PATCH 1/6] slash in the path argument of rest-style api --- node.js/core-services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index a408bb395..a444cdfe5 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -784,7 +784,7 @@ return : result of this.dispatch(req) Use this method to send synchronous requests to a service for execution. - `method` can be a HTTP method, or a name of a custom action or function -- `path` can be an arbitrary URL, starting with a leading `'/'` +- `path` can be an arbitrary URL, starting with a leading `'/'`, it is passed to a service without any modification as a string. Examples: @@ -1125,7 +1125,7 @@ srv.patch('/Books',...) --> srv.send('PATCH','/Books',...) srv.delete('/Books',...) --> srv.send('DELETE','/Books',...) ``` -You can also use them as REST-style variants to run queries by omitting the leading slash in the `path` argument, or by passing a reflected entity definition instead. In that case they start constructing *bound* [`cds.ql` query objects](cds-ql), as their [CRUD-style counterparts](#crud-style-api): +Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. But you can also use these methods as REST-style variants to run queries by omitting the leading slash in the `path` argument, or by passing a reflected entity definition instead. In that case they start constructing *bound* [`cds.ql` query objects](cds-ql), as their [CRUD-style counterparts](#crud-style-api): ```js await srv.get(Books,201) From 2aed023b9c7c650ad15a91b3620131f33369ab62 Mon Sep 17 00:00:00 2001 From: D070615 Date: Thu, 5 Oct 2023 16:06:48 +0200 Subject: [PATCH 2/6] review fix --- node.js/core-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index 0aff23438..f51eb8b4b 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -1125,7 +1125,7 @@ srv.patch('/Books',...) --> srv.send('PATCH','/Books',...) srv.delete('/Books',...) --> srv.send('DELETE','/Books',...) ``` -Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. But you can also use these methods as REST-style variants to run queries by omitting the leading slash in the `path` argument, or by passing a reflected entity definition instead. In that case they start constructing *bound* [`cds.ql` query objects](cds-ql), as their [CRUD-style counterparts](#crud-style-api): +Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. Omitting the leading slash or passing a reflected entity definition instead, leads to construction of *bound* [`cds.ql` query objects](cds-ql), equivalent to [CRUD-style API](#crud-style-api): ```js await srv.get(Books,201) From 8fda54053f62d1dc9e6b8c8f39752f841234fcb5 Mon Sep 17 00:00:00 2001 From: Olena Date: Tue, 10 Oct 2023 10:17:31 +0200 Subject: [PATCH 3/6] review fix Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> --- node.js/core-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index f51eb8b4b..c4b5afce5 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -1125,7 +1125,7 @@ srv.patch('/Books',...) --> srv.send('PATCH','/Books',...) srv.delete('/Books',...) --> srv.send('DELETE','/Books',...) ``` -Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. Omitting the leading slash or passing a reflected entity definition instead, leads to construction of *bound* [`cds.ql` query objects](cds-ql), equivalent to [CRUD-style API](#crud-style-api): +Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. Omitting the leading slash or passing a reflected entity definition instead, constructs *bound* [`cds.ql` query objects](cds-ql), equivalent to [CRUD-style API](#crud-style-api): ```js await srv.get(Books,201) From a22dc6089a38f330f7e0aaa26f0bc56ed1771b3e Mon Sep 17 00:00:00 2001 From: Olena Date: Tue, 10 Oct 2023 10:24:05 +0200 Subject: [PATCH 4/6] Update node.js/core-services.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- node.js/core-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index c4b5afce5..69fa34932 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -1125,7 +1125,7 @@ srv.patch('/Books',...) --> srv.send('PATCH','/Books',...) srv.delete('/Books',...) --> srv.send('DELETE','/Books',...) ``` -Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent to a service unmodified. Omitting the leading slash or passing a reflected entity definition instead, constructs *bound* [`cds.ql` query objects](cds-ql), equivalent to [CRUD-style API](#crud-style-api): +Leading slash in the `path` argument results in the same behaviour as in `srv.send()`: `path` is sent unmodified to a service. Omitting the leading slash, or passing a reflected entity definition instead, constructs *bound* [`cds.ql` query objects](cds-ql), equivalent to [CRUD-style API](#crud-style-api): ```js await srv.get(Books,201) From 901094c067c99241e0ae12e234d72e466bbee28c Mon Sep 17 00:00:00 2001 From: Olena Date: Tue, 10 Oct 2023 10:24:14 +0200 Subject: [PATCH 5/6] Update node.js/core-services.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- node.js/core-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index 69fa34932..148d10e43 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -784,7 +784,7 @@ return : result of this.dispatch(req) Use this method to send synchronous requests to a service for execution. - `method` can be a HTTP method, or a name of a custom action or function -- `path` can be an arbitrary URL, starting with a leading `'/'`, it is passed to a service without any modification as a string. +- `path` can be an arbitrary URL, starting with a leading `'/'`, it is passed to a service without any modification as a string Examples: From abc129f1f6454b7e428cfa3fd5862f0ea23433fe Mon Sep 17 00:00:00 2001 From: Olena Date: Tue, 10 Oct 2023 10:24:21 +0200 Subject: [PATCH 6/6] Update node.js/core-services.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- node.js/core-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index 148d10e43..dc06b9f9a 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -783,7 +783,7 @@ return : result of this.dispatch(req) Use this method to send synchronous requests to a service for execution. -- `method` can be a HTTP method, or a name of a custom action or function +- `method` can be an HTTP method, or a name of a custom action or function - `path` can be an arbitrary URL, starting with a leading `'/'`, it is passed to a service without any modification as a string Examples: