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: admin/getting-started.md
+51-20Lines changed: 51 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,10 @@ Then, create a new React application for your admin:
11
11
12
12
$ create-react-app my-admin
13
13
14
+
Now, go to the newly created `my-admin` directory:
15
+
16
+
$ cd my-admin
17
+
14
18
React and React DOM will be directly provided as dependencies of Admin On REST. As having different versions of React
15
19
causes issues, remove `react` and `react-dom` from the `dependencies` section of the generated `package.json` file:
16
20
@@ -34,6 +38,12 @@ import { HydraAdmin } from '@api-platform/admin';
34
38
exportdefault () =><HydraAdmin entrypoint="https://demo.api-platform.com"/>; // Replace with your own API entrypoint
35
39
```
36
40
41
+
Be sure to make your API send proper [CORS HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) to allow the admin's domain to access it. To do so, update the value of the `cors_allow_origin` parameter in `app/config/parameters.yml` (it will be `http://localhost:3000` by default).
Your new administration interface is ready! Type `yarn start` to try it!
38
48
39
49
Note: if you don't want to hardcode the API URL, you can [use an environment variable](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-custom-environment-variables).
@@ -51,27 +61,31 @@ In the following example, we change components used for the `description` proper
0 commit comments