12.10 g0v JS Workshop: Serverless React

編輯歷史

時間 作者 版本
2016-12-12 15:11 – 15:22 Hsin Hsiao r558 – r592
顯示 diff
12.1w g0v JS Wrkshop : Serverless React
+ 筆記未完待補
*repo: https://github.com/hsin421/g0v-coding-workshop
*install https://nodejs.org/en/
(28 行未修改)
To solve 'access-control-allow-origin problem'
'Enable CORS'
-
+
+ and add the above "access-control..." to your lambda code
AWS DynamoDB
create Table: choose a primary key (like userId) and a sort key
(17 行未修改)
2016-12-12 05:21 – 05:27 Hsin Hsiao r152 – r557
顯示 diff
- workshop 步驟
-
+ 12.1w g0v JS Wrkshop : Serverless React
*repo: https://github.com/hsin421/g0v-coding-workshop
*install https://nodejs.org/en/
(8 行未修改)
*go to localhost:8080
*
+
+ AWS Lambda
+
+ Choose Microservice from blueprints
+
+ In security: choose 'open', and next
+
+ type your lambda function name and 'create a new role.' Enter a role name.
+ Create lambda functino
Needed headers in lambda code:
'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization',
- 'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE',
- 'Access-Control-Allow-Origin': '*'
+ 'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE',
+ 'Access-Control-Allow-Origin': '*'
+
+ AWS API GATEWAY
+ To solve 'access-control-allow-origin problem'
+ 'Enable CORS'
+
+ AWS DynamoDB
+ create Table: choose a primary key (like userId) and a sort key
+
+ AWS S3
+ To deploy your site, use webpack to build your bundle by either 'node_modules/.bin/webpack' or 'npm run build'
+
+ Then upload your two files in ./build folder: index.html and bundle.js to a S3 bucket.
+
+ In the bucket settings, choose 'Enable static website hosting' and type index.html into the index document box.
+
+ Also, choose the two uploaded files, and in 'Actions' choose 'Make Public'
+
+ Results
+
Deployed address
http://g0v-example-workshop.s3-website-us-east-1.amazonaws.com/
(3 行未修改)
2016-12-10 17:19 – 18:22 Hsin Hsiao r103 – r151
顯示 diff
(12 行未修改)
*go to localhost:8080
*
+
+ Needed headers in lambda code:
'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization',
'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE',
'Access-Control-Allow-Origin': '*'
+
+ Deployed address
+ http://g0v-example-workshop.s3-website-us-east-1.amazonaws.com/
+
+ Workshop Github source
+ https://github.com/hsin421/g0v-workshop-example-2
2016-12-10 16:47 (unknown) r102
顯示 diff
(18 行未修改)
2016-12-10 16:47 – 16:47 Hsin Hsiao r100 – r101
顯示 diff
(12 行未修改)
*go to localhost:8080
*
+
+ 'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization',
+ 'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE',
+ 'Access-Control-Allow-Origin': '*'
2016-12-10 16:29 Yen-Ting Liu r99
顯示 diff
(11 行未修改)
*open browser
*go to localhost:8080
+ *
2016-12-10 16:04 – 16:07 Hsin Hsiao r1 – r98
顯示 diff
- Untitled
+ workshop 步驟
- This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!
+ *repo: https://github.com/hsin421/g0v-coding-workshop
+ *install https://nodejs.org/en/
+ *download zip
+ *unzip
+ *open terminal
+ *cd 'Downloads'
+ *cd 'g0v-coding-workshop-master'
+ *npm install
+ *npm run dev
+ *open browser
+ *go to localhost:8080
2016-12-10 16:04 (unknown) r0
顯示 diff
+ Untitled
+ This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!