Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws/static-site): support routes arg #320

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

NamesMT
Copy link
Contributor

@NamesMT NamesMT commented Apr 27, 2024

Refactored to use Router under-the-hood :D, tested locally with working dev, HMR, deploy.
Resolves #311

Tested used without routes arg. (like current)
Tested with routes from APIGatewayV2, Function

@NamesMT
Copy link
Contributor Author

NamesMT commented Apr 27, 2024

Example snippet of the routes usage:

const backend = new sst.aws.Function('Backend', {
  url: true,
  handler: 'apps/backend/src/index.handler',
})

const staticSiteDistribution = new sst.aws.StaticSite('StaticFullstack', {
  build: {
    command: 'pnpm run build --filter="frontend"',
    output: 'apps/frontend/.output/public',
  },
  routes: {
    '/api/*': backend.url,
  },
})

This deploys my starter-fullstack template to Cloudfront, with the static frontend and Hono backend served on the same domain, with working Live development access from Cloudfront's url.

NamesMT

This comment was marked as off-topic.

@NamesMT
Copy link
Contributor Author

NamesMT commented Apr 30, 2024

Note: this update if merged as-is will remove and re-create the distribution for existing deploys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static frontend + API/Function
1 participant