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: examples/cms-strapi/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,7 @@ You should now be able to see the draft post. To exit the preview mode, you can
179
179
180
180
### Step 10. Deploy Strapi
181
181
182
-
To deploy to production, you must first deploy your Strapi app. The Strapi app for our demo at https://next-blog-strapi.vercel.app/ is deployed to Heroku ([here’s the documentation](https://strapi.io/documentation/v3.x/deployment/heroku.html)) and uses Cloudinary for image hosting ([see this file](https://github.com/strapi/strapi-starter-next-blog/blob/master/backend/extensions/upload/config/settings.js)).
182
+
To deploy to production, you must first deploy your Strapi app. The Strapi app for our demo at https://next-blog-strapi.vercel.app/ is deployed to Heroku ([here’s the documentation](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/heroku.html)) and uses Cloudinary for image hosting ([see this file](https://github.com/strapi/strapi-starter-next-blog/blob/23b184781a3f219ad472f6a2c3a3d239a3d16513/backend/extensions/upload/config/settings.js)).
Copy file name to clipboardExpand all lines: examples/with-aws-amplify-typescript/README.md
+65-17Lines changed: 65 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ This example shows how to build a server rendered web application with NextJS an
6
6
7
7
Two routes are implemented :
8
8
9
-
-`/` : A static route that uses getStaticProps to load data from AppSync and renders it on the server (Code in [pages/index.tsx](pages/index.tsx))
9
+
-`/` : A server-rendered route that uses `getServersideProps` to load data from AppSync and renders it on the server (Code in [pages/index.tsx](src/pages/index.tsx))
10
10
11
-
-`/todo/[id]` : A dynamic route that uses `getStaticProps` and the id from the provided context to load a single todo from AppSync and render it on the server. (Code in [pages/todo/[id].tsx](pages/todo/[id].tsx))
11
+
-`/todo/[id]` : A dynamic route that uses `getStaticPaths`, `getStaticProps` and the id from the provided context to load a single todo from AppSync and render it on the server. (Code in [pages/todo/[id].tsx](src/pages/todo/[id].tsx))
12
12
13
13
## How to use
14
14
@@ -59,15 +59,17 @@ $ amplify init
59
59
❯ javascript
60
60
? What javascript framework are you using react
61
61
? Source Directory Path: src
62
-
? Distribution Directory Path: out
63
-
? Build Command: (npm run-script build)
64
-
? Start Command: (npm run-script start)
62
+
? Distribution Directory Path: build
63
+
? Build Command: npm run build
64
+
? Start Command: npm run start
65
65
? Do you want to use an AWS profile? Y
66
+
? Select the authentication method you want to use: AWS Profile
67
+
? Please choose the profile you want to use: <Your profile
66
68
67
69
# </Interactive>
68
70
```
69
71
70
-
#### Add the API
72
+
#### Add the API and the Auth
71
73
72
74
```sh
73
75
$ amplify add api
@@ -76,14 +78,66 @@ $ amplify add api
76
78
❯ GraphQL
77
79
REST
78
80
? Provide API name: <API_NAME>
79
-
? Choose an authorization type for the API (Use arrow keys)
81
+
? Choose the default authorization type for the API (Use arrow keys)
80
82
❯ API key
81
83
Amazon Cognito User Pool
82
-
? Do you have an annotated GraphQL schema? (y/N) y
83
-
? Provide your schema file path: ./schema.graphql
84
+
IAM
85
+
OpenID Connect
86
+
? Enter a description for the API key: <API_DESCRIPTION>
87
+
? After how many days from now the API key should expire (1-365): 7
88
+
? Do you want to configure advanced settings for the GraphQL API:
89
+
No, I am done.
90
+
❯ Yes, I want to make some additional changes.
91
+
? Configure additional auth types? y
92
+
? Choose the additional authorization types you want to configure for the API
93
+
❯(*) Amazon Cognito User Pool
94
+
( ) IAM
95
+
( ) OpenID Connect
96
+
Do you want to use the default authentication and security configuration? (Use arrow keys)
97
+
❯ Default configuration
98
+
Default configuration with Social Provider (Federation)
99
+
Manual configuration
100
+
I want to learn more.
101
+
How do you want users to be able to sign in? (Use arrow keys)
102
+
Username
103
+
❯ Email
104
+
Phone Number
105
+
Email or Phone Number
106
+
I want to learn more.
107
+
Do you want to configure advanced settings? (Use arrow keys)
108
+
❯ No, I am done.
109
+
Yes, I want to make some additional changes.
110
+
? Enable conflict detection? N
111
+
? Do you have an annotated GraphQL schema? N
112
+
? Choose a schema template: (Use arrow keys)
113
+
❯ Single object with fields (e.g., “Todo” with ID, name, description)
114
+
One-to-many relationship (e.g., “Blogs” with “Posts” and “Comments”)
115
+
Objects with fine-grained access control (e.g., a project management app with owner-based authorization)
116
+
? Do you want to edit the schema now? Y
84
117
# </Interactive>
85
118
```
86
119
120
+
#### Edit GraphQL Schema
121
+
122
+
Open [`amplify/backend/api/nextjswithamplifyts/schema.graphql`](amplify/backend/api/nextjswithamplifyts/schema.graphql) and change it to the following:
123
+
124
+
```
125
+
type Todo
126
+
@model
127
+
@auth(
128
+
rules: [
129
+
{ allow: owner } # Allow the creator of a todo to perform Create, Update, Delete operations.
130
+
{ allow: public, operations: [read] } # Allow public (guest users without an account) to Read todos.
131
+
{ allow: private, operations: [read] } # Allow private (other signed in users) to Read todos.
132
+
]
133
+
) {
134
+
id: ID!
135
+
name: String!
136
+
description: String
137
+
}
138
+
139
+
```
140
+
87
141
#### Deploy infrastructure
88
142
89
143
```sh
@@ -95,10 +149,10 @@ $ amplify push
95
149
javascript
96
150
❯ typescript
97
151
flow
98
-
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.js)
152
+
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.ts)
99
153
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions (Y/n) Y
100
154
? Enter maximum statement depth [increase from default if your schema is deeply nested] (2)
101
-
155
+
? Enter the file name for the generated code: src\API.ts
102
156
# </Interactive>
103
157
```
104
158
@@ -111,9 +165,3 @@ npm run dev
111
165
yarn
112
166
yarn dev
113
167
```
114
-
115
-
### Edit GraphQL Schema
116
-
117
-
1. Open [`amplify/backend/api/nextjswithamplifyts/schema.graphql`](amplify/backend/api/nextjswithamplifyts/schema.graphql) and change what you need to.
0 commit comments