Skip to content

Commit

Permalink
Remove api gateway from aws lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sumi-k committed Feb 19, 2024
1 parent 66a5276 commit 2d79a1f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 79 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/deploy-frontend-dev.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: DeployFrontendServerlessDev

on:
workflow_run:
workflows: ["DeployBackendDev"]
types:
- completed
branches:
- "master"
push

jobs:
deploy-frontend-dev:
Expand Down
98 changes: 27 additions & 71 deletions infrastructure/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,69 +22,6 @@ Parameters:
Description: Cloudfront URL.

Resources:
HttpApi:
Type: AWS::Serverless::HttpApi
Properties:
StageName: $default
Description:
Fn::Sub: Canopas Website SSR Frontend API ${EnvName}
DefinitionBody:
openapi: "3.0.1"
info:
title:
Fn::Sub: canopas-website-ssr-frontend-${EnvName}
version: "1.0"
paths:
/favicon.ico:
x-amazon-apigateway-any-method:
responses:
default:
description: "Default response for ANY /favicon.ico"
x-amazon-apigateway-integration:
payloadFormatVersion: "1.0"
type: "http_proxy"
httpMethod: "ANY"
uri:
Fn::Sub: "${CloudfrontURL}favicon.ico"
connectionType: "INTERNET"
/sitemap.xml:
x-amazon-apigateway-any-method:
responses:
default:
description: "Default response for ANY /sitemap.xml"
x-amazon-apigateway-integration:
payloadFormatVersion: "1.0"
type: "http_proxy"
httpMethod: "ANY"
uri:
Fn::Sub: "${CloudfrontURL}sitemap.xml"
connectionType: "INTERNET"
/robots.txt:
x-amazon-apigateway-any-method:
responses:
default:
description: "Default response for ANY /robots.txt"
x-amazon-apigateway-integration:
payloadFormatVersion: "1.0"
type: "http_proxy"
httpMethod: "ANY"
uri:
Fn::Sub: "${CloudfrontURL}robots.txt"
connectionType: "INTERNET"
/apple-touch-icon.png:
x-amazon-apigateway-any-method:
responses:
default:
description: "Default response for ANY /apple-touch-icon.png"
x-amazon-apigateway-integration:
payloadFormatVersion: "1.0"
type: "http_proxy"
httpMethod: "ANY"
uri:
Fn::Sub: "${CloudfrontURL}apple-touch-icon.png"
connectionType: "INTERNET"
x-amazon-apigateway-importexport-version: "1.0"

HttpApiFunction:
Type: AWS::Serverless::Function
Properties:
Expand All @@ -101,11 +38,30 @@ Resources:
Fn::Sub: canopas-website-ssr-frontend-${EnvName}
Description:
Fn::Sub: Canopas Website SSR Frontend Lambda ${EnvName}
Events:
ProxyResource:
Type: HttpApi
Properties:
ApiId:
Ref: HttpApi
Path: $default
Method: any
FunctionUrlConfig:
AuthType: NONE

# CloudFrontDistribution:
# Type: AWS::CloudFront::Distribution
# Properties:
# DistributionConfig:
# PriceClass: PriceClass_All
# HttpVersion: http2
# IPV6Enabled: true
# Comment: Distribution with Lambda Function URL
# Origins:
# - DomainName:
# Fn::Select: [2,
# Fn::Split: [ "/",
# Fn::GetAtt: LambdaFunctionUrl.FunctionUrl ]]
# Id: LambdaOrigin
# CustomOriginConfig:
# HTTPSPort: 443
# OriginProtocolPolicy: https-only
# Enabled: 'true'
# DefaultCacheBehavior:
# TargetOriginId: LambdaOrigin
# CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6'
# ViewerProtocolPolicy: redirect-to-https
# SmoothStreaming: 'false'
# Compress: 'true'
2 changes: 0 additions & 2 deletions nuxt-frontend/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import { defineNuxtConfig } from "nuxt/config";
import config from "./config";

export default defineNuxtConfig({
app: {
Expand All @@ -9,7 +8,6 @@ export default defineNuxtConfig({
lang: "en",
},
},
cdnURL: config.CLOUDFRONT_URL,
},
devtools: { enabled: true },
modules: [
Expand Down

0 comments on commit 2d79a1f

Please sign in to comment.