Skip to content

Commit adbe457

Browse files
authored
Merge branch 'canary' into fix-not-exposing-server-errors
2 parents 144bb4f + 85d87a3 commit adbe457

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1536
-316
lines changed

examples/cms-strapi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ You should now be able to see the draft post. To exit the preview mode, you can
179179

180180
### Step 10. Deploy Strapi
181181

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)).
183183

184184
### Step 11. Deploy on Vercel
185185

examples/with-aws-amplify-typescript/.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ yarn-error.log*
3636
# Amplify
3737
amplify/\#current-cloud-backend
3838
amplify/.config/local-*
39+
amplify/logs
40+
amplify/mock-data
3941
amplify/backend/amplify-meta.json
4042
amplify/backend/awscloudformation
41-
build/
43+
amplify/backend/.temp
4244
dist/
4345
aws-exports.js
4446
awsconfiguration.json
47+
amplifyconfiguration.json
48+
amplifyconfiguration.dart
49+
amplify-build-config.json
50+
amplify-gradle-config.json
51+
amplifytools.xcconfig
52+
.secret-*

examples/with-aws-amplify-typescript/README.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ This example shows how to build a server rendered web application with NextJS an
66

77
Two routes are implemented :
88

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))
1010

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))
1212

1313
## How to use
1414

@@ -59,15 +59,17 @@ $ amplify init
5959
❯ javascript
6060
? What javascript framework are you using react
6161
? 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
6565
? 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
6668
6769
# </Interactive>
6870
```
6971
70-
#### Add the API
72+
#### Add the API and the Auth
7173
7274
```sh
7375
$ amplify add api
@@ -76,14 +78,66 @@ $ amplify add api
7678
❯ GraphQL
7779
REST
7880
? 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)
8082
❯ API key
8183
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
84117
# </Interactive>
85118
```
86119
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+
87141
#### Deploy infrastructure
88142
89143
```sh
@@ -95,10 +149,10 @@ $ amplify push
95149
javascript
96150
❯ typescript
97151
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)
99153
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions (Y/n) Y
100154
? 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
102156
# </Interactive>
103157
```
104158
@@ -111,9 +165,3 @@ npm run dev
111165
yarn
112166
yarn dev
113167
```
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.
118-
2. Run `amplify push`
119-
3. 👍

examples/with-aws-amplify-typescript/package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@
33
"version": "1.0.0",
44
"description": "",
55
"scripts": {
6-
"dev": "next",
6+
"dev": "next dev",
77
"build": "next build",
88
"start": "next start"
99
},
1010
"keywords": [],
1111
"author": "",
1212
"license": "MIT",
1313
"dependencies": {
14-
"aws-amplify": "2.1.0",
15-
"immer": "3.1.3",
16-
"nanoid": "2.0.3",
17-
"next": "latest",
18-
"react": "16.13.1",
19-
"react-dom": "16.13.1"
14+
"@aws-amplify/ui-react": "^1.0.7",
15+
"aws-amplify": "^3.3.27",
16+
"next": "10.1.3",
17+
"react": "17.0.2",
18+
"react-dom": "17.0.2"
2019
},
2120
"devDependencies": {
22-
"@types/node": "12.6.8",
23-
"@types/react": "16.9.36",
24-
"@types/react-dom": "16.9.8",
25-
"typescript": "4.0"
21+
"@types/node": "^14.14.41",
22+
"@types/react": "^17.0.3",
23+
"@types/react-dom": "^17.0.3",
24+
"typescript": "^4.2.4"
2625
}
2726
}

examples/with-aws-amplify-typescript/pages/index.tsx

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)