Skip to content

Commit 1391fd6

Browse files
iartemievjosefaidt
andauthored
Apply suggestions from code review
Co-authored-by: josef <[email protected]>
1 parent 230cbd9 commit 1391fd6

File tree

1 file changed

+8
-11
lines changed
  • src/pages/[platform]/build-a-backend/data/connect-event-api

1 file changed

+8
-11
lines changed

src/pages/[platform]/build-a-backend/data/connect-event-api/index.mdx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,12 @@ export default function App() {
100100

101101
## Add an Event API to an existing Amplify backend
102102

103-
This guide walks through how you can add an Event API to an existing Amplify backend.
104-
We'll be using Cognito User Pools for authenticating with Event API from our frontend application.
105-
Any signed in user will be able to subscribe to the Event API and publish events.
103+
This guide walks through how you can add an Event API to an existing Amplify backend. We'll be using Cognito User Pools for authenticating with Event API from our frontend application. Any signed in user will be able to subscribe to the Event API and publish events.
106104

107105
Before you begin, you will need:
108106

109107
- An existing Amplify backend (see [Quickstart](/[platform]/start/quickstart/))
110-
- Latest versions of `@aws-amplify/backend` and `@aws-amplify/backend-cli` (`npm i @aws-amplify/backend@latest @aws-amplify/backend-cli@latest`)
108+
- Latest versions of `@aws-amplify/backend` and `@aws-amplify/backend-cli` (`npm add @aws-amplify/backend@latest @aws-amplify/backend-cli@latest`)
111109

112110
### Update Backend Definition
113111

@@ -135,7 +133,7 @@ const backend = defineBackend({
135133
const customResources = backend.createStack('custom-resources');
136134

137135
// add a new Event API to the stack:
138-
const cfnEventAPI = new CfnApi(customResources, 'cfnEventAPI', {
136+
const cfnEventAPI = new CfnApi(customResources, 'CfnEventAPI', {
139137
name: 'my-event-api',
140138
eventConfig: {
141139
authProviders: [
@@ -158,7 +156,7 @@ const cfnEventAPI = new CfnApi(customResources, 'cfnEventAPI', {
158156
// create a default namespace for our Event API:
159157
const namespace = new CfnChannelNamespace(
160158
customResources,
161-
'cfnEventAPINamespace',
159+
'CfnEventAPINamespace',
162160
{
163161
apiId: cfnEventAPI.attrApiId,
164162
name: 'default',
@@ -204,20 +202,19 @@ npx ampx sandbox
204202

205203
### Connect your frontend application
206204

207-
After the sandbox deploys, connect your frontend application to the Event API.
208-
We'll be using the Amplify Authenticator to sign in to our Cognito User Pool.
205+
After the sandbox deploys, connect your frontend application to the Event API. We'll be using the [Amplify Authenticator component](https://ui.docs.amplify.aws/react/connected-components/authenticator) to sign in to our Cognito User Pool.
209206

210-
If you don't already have the Authenticator installed, you can install it by running `npm i @aws-amplify/ui-react`.
207+
If you don't already have the Authenticator installed, you can install it by running `npm add @aws-amplify/ui-react`.
211208

212209
```tsx title="src/App.tsx"
213210
import { useEffect, useState } from 'react';
214211
import { Amplify } from 'aws-amplify';
215212
import { events, type EventsChannel } from 'aws-amplify/data';
216213
import { Authenticator } from '@aws-amplify/ui-react';
217214
import '@aws-amplify/ui-react/styles.css';
218-
import config from '@/amplify_outputs.json';
215+
import outputs from '../amplify_outputs.json';
219216

220-
Amplify.configure(config);
217+
Amplify.configure(outputs);
221218

222219
export default function App() {
223220
const [myEvents, setMyEvents] = useState<Record<string, any>[]>([]);

0 commit comments

Comments
 (0)