Skip to content

Commit

Permalink
edge-api-swager-endpoint: alter api for endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbalfour committed Apr 8, 2024
1 parent 008a4d0 commit 2e44b51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/constructs/edge-api-swagger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reapit-cdk/edge-api-swagger",
"version": "0.1.4",
"version": "0.1.5",
"description": "Add a swagger endpoint to your EdgeAPI",
"homepage": "https://github.com/reapit/ts-cdk-constructs/blob/main/packages/constructs/edge-api-swagger",
"readme": "https://github.com/reapit/ts-cdk-constructs/blob/main/packages/constructs/edge-api-swagger/readme.md",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EdgeAPI, IFrontendEndpoint, endpointIsLambdaEndpoint, endpointIsProxyEndpoint } from '@reapit-cdk/edge-api'
import { EdgeAPI, FrontendEndpoint, endpointIsLambdaEndpoint, endpointIsProxyEndpoint } from '@reapit-cdk/edge-api'
import { Construct } from 'constructs'

import { Bucket } from 'aws-cdk-lib/aws-s3'
Expand Down Expand Up @@ -49,7 +49,7 @@ const swaggerHtml = (urlPrefix: string) => `<!DOCTYPE html>
</body>
</html>`

export class EdgeAPISwaggerEndpoint extends Construct implements IFrontendEndpoint {
export class EdgeAPISwaggerEndpoint extends Construct {
bucket: Bucket
invalidationItems: string[] | undefined = [
'/index.html',
Expand All @@ -59,6 +59,7 @@ export class EdgeAPISwaggerEndpoint extends Construct implements IFrontendEndpoi
'/swagger-ui.css',
]
pathPattern: string
endpoint: FrontendEndpoint

constructor(scope: Construct, id: string, props: EdgeAPISwaggerEndpointProps) {
super(scope, id)
Expand Down Expand Up @@ -119,5 +120,7 @@ export class EdgeAPISwaggerEndpoint extends Construct implements IFrontendEndpoi
destinationKeyPrefix,
retainOnDelete: false,
})

this.endpoint = new FrontendEndpoint(this)
}
}
2 changes: 1 addition & 1 deletion packages/constructs/edge-api-swagger/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ api.addEndpoint(
title: '', // defaults to Edge API
version: '', // defaults to 1.0.0
},
}),
}).endpoint,
)

0 comments on commit 2e44b51

Please sign in to comment.