Why Cloudflare?
Hey guys, I found your solution like 30 minutes ago, super cool and I'm trying to deploy to test and use.
I was just thinking about, as the main api runs all in AWS why are you using cloudflare for the frontend deployment?
My suggestion is going with a serverless.yml file in the root folder (web) with something like this inside:
```
service: mailbox-browser
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
environment:
VITE_AWS_API_ID: <AWS_API_ID>
VITE_AWS_API_GATEWAY_ENDPOINT: <AWS_API_GATEWAY_ENDPOINT>
VITE_EMAIL_ADDRESSES: ["example.com"]
...
plugins:
- serverless-lift
constructs:
landing-page:
type: static-website
path: 'dist'
extensions:
bucket:
Properties:
PublicAccessBlockConfiguration:
BlockPublicPolicy: false
```
It uses https://github.com/getlift/lift behind the scenes, you need to install it `npm install --save-dev serverless-lift`.
It's super simple, cheap, scalable and you can kill everything except `web` folder. Plus, you can wrap with the API deployment with CF Outputs in order to auto fill the env variables.
You can have custom domain and etc.
关闭于 2024-01-31 5 条评论