Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Supporting new `cds-plugin` technique for zero configuration
- Support for filtering by `null` values

### Changed
Expand Down
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,14 @@ _**WARNING:** This package is in an early general availability state. This means

## Requirements and Setup

1. Add the GraphQL adapter to your project using `npm`:
```js
npm add @cap-js/graphql
```

2. Register the GraphQL adapter in your project's `package.json`:
```jsonc
{
"cds": {
"protocols": {
"graphql": { "path": "/graphql", "impl": "@cap-js/graphql" }
}
}
}
```
> Note: This automatically enables the new [middlewares architecture](https://cap.cloud.sap/docs/node.js/middlewares) in Node.js.
1. Simply add the GraphQL adapter to your project using `npm`:
```js
npm add @cap-js/graphql
```

> This will automatically plugin to `@sap/cds` runtime, enabling the new [middlewares architecture](https://cap.cloud.sap/docs/node.js/middlewares) in Node.js, and register a GraphQL endpoint at `/graphql` serving all CRUD requests for the application services found in your model.

3. Run your server as usual, e.g. using `cds watch`.
2. Run your server as usual, e.g. using `cds watch`.
> The runtime will automatically serve all services via GraphQL at the default configured endpoint.

## Limitations
Expand Down
5 changes: 5 additions & 0 deletions cds-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const cds = require('@sap/cds')
const protocols = cds.env.protocols ??= {}
if (!protocols.graphql) protocols.graphql = {
path: "/graphql", impl: "@cap-js/graphql"
}