- GET
/api/data
which will return sample data from Google Sheets through the Google APIs - POST
/api/report
which will run JSreport as a serverless function
Took inspiration from this article.
Both endpoints
A simple frontend client for the backend, built with React and Parcel Bundler.
- create an S3 bucket and configure it for website hosting
- name it the same as the domain you'll use for its cloudfront distribution in Route 53
- index.html should map as default success and error page
- create a Cloufront distribution and take the S3 created above as origin
- configure it as http redirecting to https
- default root object should be index.html
- create a Route 53 recordset pointing to the Cloudfront distribution
More details in the process on this article.
- Create a Cognito User Pool and
- On that user pool create 2 app clients
- one for local development, the callback and logout urls
http://localhost:3000
- the other for production , the callback and logout urls are the ones sets in the Route 53 entry created in before
- one for local development, the callback and logout urls
- On that user pool create 2 app clients
- Create a Project in Google Cloud's Web Console
- Enable the following APIs for the google cloud project
- Select the Google Cloud Project in the Google Cloud Dashboard
- Create a Service Account (From now on called
google service account
)- Create a key (Look for the "CREATE KEY" button in the view page of the Service Account just created)
- Download the Credentials as JSON file
- Store it in your local project's folder as
backend/google.json
- Share the sheet with the email of the Service Account
cd frontend
cp .env.example .env.local
(and edit.env.local
with the proper values)npm install
npm start
cd backend
cp .env.example .env
(and edit.env
with the proper values)npm install
- unzip
backend/layer/googleapis.zip
inbackend/layer/googleapis/
- unzip
backend/layer/jsreports.zip
inbackend/layer/jsreports/
npm run-script dev
- Deploy the serverless app with
AWS_PROFILE=architecture dotenv -e .env.production -- serverless deploy --stage dev
- copy the base url of your functions
- set this url as backend url in the production
.env
of the frontend
rm -rf dist/* && NODE_ENV=production parcel build index.html
aws s3 sync dist/ s3://{{the url of your route 53 record}} --delete
(replace the value among brackets for the real one)- invalidate the cloudfront distribution