You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: client-generator/nextjs.md
+10-21Lines changed: 10 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,15 @@ The Next.js Client Generator generates routes and components for Server Side Ren
10
10
11
11
Create a [Next.js application with express server](https://github.com/zeit/next.js/tree/canary/examples/custom-server-express). The easiest way is to execute:
$ npx @api-platform/client-generator https://demo.api-platform.com src/ --generator next --resource book
92
-
# Replace the URL by the entrypoint of your Hydra-enabled API
93
-
```
83
+
$ npx @api-platform/client-generator https://demo.api-platform.com src/ --generator next --resource book
84
+
# Replace the URL by the entrypoint of your Hydra-enabled API
94
85
95
86
> Note: Omit the resource flag to generate files for all resource types exposed by the API.
96
87
97
88
If your express server is compatible with the `custom-server-express` Next.js example, you can use the `server-path` flag to specify path to the server file. Routes will be added automatically to this file, otherwise, you will receive some hints on how to them to your own custom server.
98
89
99
-
```bash
100
-
$ npx @api-platform/client-generator https://demo.api-platform.com src/ --generator next --server-path ./server.js
101
-
```
90
+
$ npx @api-platform/client-generator https://demo.api-platform.com src/ --generator next --server-path ./server.js
102
91
103
92
Go to `https://localhost:3000/books/` to start using your app.
# Replace the URL by the entrypoint of your Hydra-enabled API
9
+
# "src/" represents where the interfaces will be generated
10
+
# Omit the resource flag to generate files for all resource types exposed by the API
13
11
14
12
This command parses the Hydra documentation and creates one `.ts` file for each API Resource you have defined in your application, in the `interfaces` subfolder.
15
13
@@ -19,9 +17,7 @@ NOTE: If you are not sure what the entrypoint is, see [Troubleshooting](troubles
19
17
20
18
Assuming you have 2 resources in your application, `Foo` and `Bar`, when you run
Copy file name to clipboardExpand all lines: core/graphql.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# GraphQL Support
2
2
3
-
## Overall View
4
-
5
3
[GraphQL](http://graphql.org/) is a query language made to communicate with an API and therefore is an alternative to REST.
6
4
7
5
It has some advantages compared to REST: it solves the over-fetching or under-fetching of data, is strongly typed, and is capable of retrieving multiple and nested data in one go, but it also comes with drawbacks. For example it creates overhead depending on the request.
@@ -14,9 +12,7 @@ Once enabled, you have nothing to do: your schema describing your API is automat
14
12
15
13
To enable GraphQL and its IDE (GraphiQL and GraphQL Playground) in your API, simply require the [graphql-php](https://webonyx.github.io/graphql-php/) package using Composer and clear the cache one more time:
Copy file name to clipboardExpand all lines: core/mercure.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,18 @@
3
3
API Platform can automatically send real time updates to the currently connected clients (webapps, mobile apps...) using [the Mercure protocol](https://mercure.rocks).
4
4
5
5
> *Mercure* is a protocol allowing to push data updates to web browsers and other HTTP clients in a convenient, fast, reliable and battery-efficient way. It is especially useful to publish real-time updates of resources served through web APIs, to reactive web and mobile apps.
6
-
> -https://mercure.rocks
6
+
>
7
+
> —https://mercure.rocks
7
8
8
9
API Platform detects changes made to your Doctrine entities, and sends the updated resources to the Mercure hub.
9
10
Then, the Mercure hub dispatches the updates to all connected clients using [Server-sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
The Mercure support is already installed, configured and enabled in [the official distribution](../distribution/index.md).
16
-
If you use the distribution, you have nothing more to do, and you can jump to the next section.
16
+
Mercure support is already installed, configured and enabled in [the API Platform distribution](../distribution/index.md).
17
+
If you use the distribution, you have nothing more to do, and you can skip to the next section.
17
18
18
19
If you have installed API Platform using another method (such as `composer require api`), you need to install a Mercure hub, and the [Symfony MercureBundle](https://github.com/symfony/mercure-bundle):
Copy file name to clipboardExpand all lines: core/mongodb.md
+7-17Lines changed: 7 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,38 +16,32 @@ the legacy [mongo](https://secure.php.net/manual/en/book.mongo.php) extension.
16
16
17
17
## Enabling MongoDB Support
18
18
19
-
If the mongodb PHP extension is not installed yet, [install it beforehand](https://secure.php.net/manual/en/mongodb.installation.pecl.php).
19
+
If the `mongodb` PHP extension is not installed yet, [install it beforehand](https://secure.php.net/manual/en/mongodb.installation.pecl.php).
20
20
21
-
If you are using the [API Platform Distribution](../distribution/index.md), modify the Dockerfile to add the extension:
21
+
If you are using the [API Platform Distribution](../distribution/index.md), modify the `Dockerfile` to add the extension:
22
22
23
23
```diff
24
-
// api/Dockerfile
25
-
26
-
...
24
+
# api/Dockerfile
27
25
pecl install \
28
26
apcu-${APCU_VERSION} \
29
27
+ mongodb \
30
28
; \
31
-
...
29
+
pecl clear-cache; \
32
30
docker-php-ext-enable \
33
31
apcu \
34
-
opcache \
35
32
+ mongodb \
33
+
opcache \
36
34
; \
37
-
...
38
35
```
39
36
40
37
Then rebuild the `php` image:
41
38
42
-
```bash
43
-
docker-compose build php
44
-
```
39
+
$ docker-compose build php
45
40
46
41
Add a MongoDB image to the docker-compose file:
47
42
48
43
```yaml
49
44
# docker-compose.yml
50
-
51
45
# ...
52
46
db-mongodb:
53
47
# In production, you may want to use a managed database service
@@ -69,17 +63,14 @@ Add a MongoDB image to the docker-compose file:
69
63
Once the extension is installed, to enable the MongoDB support, require the [Doctrine MongoDB ODM bundle](https://github.com/doctrine/DoctrineMongoDBBundle)
0 commit comments