This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
dynamodb-local: | |
command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data" | |
image: "amazon/dynamodb-local:latest" | |
container_name: dynamodb-local-latest | |
ports: | |
- "8000:8000" | |
volumes: | |
- "./docker/dynamodb:/home/dynamodblocal/data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
testEnvironment: "node", | |
roots: ["<rootDir>/src"], | |
testMatch: ["**/*.int.ts"], | |
transform: { | |
"^.+\\.tsx?$": "ts-jest", | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
testEnvironment: "node", | |
roots: ["<rootDir>/src"], | |
testMatch: ["**/*.spec.ts"], | |
transform: { | |
"^.+\\.tsx?$": "ts-jest", | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Collection, | |
Db, | |
Document, | |
FindOptions, | |
InsertOneOptions, | |
InsertOneResult, | |
MongoClient, | |
MongoClientOptions, | |
WithId, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
APIGatewayEvent, | |
APIGatewayProxyHandler, | |
APIGatewayProxyResult, | |
} from "aws-lambda"; | |
import { config } from "../../../config"; | |
import { create } from "../../../service-layer"; | |
export const handler: APIGatewayProxyHandler = async ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
APIGatewayEvent, | |
APIGatewayProxyHandler, | |
APIGatewayProxyResult, | |
} from "aws-lambda"; | |
import { Collection, Db, InsertOneResult, MongoClient } from "mongodb"; | |
import { buildMongoClient, connectToDatabase } from "../../../common"; | |
import { config } from "../../../config"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios, { AxiosResponse } from "axios"; | |
export const findOne = async ( | |
serviceLayerUrl: string, | |
collectionName: string, | |
id: string | number | |
) => { | |
const { data }: { data: Order } = await axios.post( | |
`http://${serviceLayerUrl}/findOne`, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// updateBlog mutation with cache invalidation | |
blogTableDataSource.createResolver({ | |
typeName: "Mutation", | |
fieldName: "updateBlog", | |
// this is an example of a vtl template generated with the helper methods | |
requestMappingTemplate: appsync.MappingTemplate.dynamoDbPutItem( | |
appsync.PrimaryKey.partition("id").is("input.id"), | |
appsync.Values.projecting("input") | |
), | |
// this is an example of an inline vtl response template (you can also pull in from a file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($cachingKeys = {}) | |
$util.qr($cachingKeys.put("context.arguments.id", $context.arguments.id)) | |
$extensions.evictFromApiCache("Query", "getBlogNoDax", $cachingKeys) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// appsync lambda data source | |
const blogNoDaxDataSource: appsync.LambdaDataSource = | |
new appsync.LambdaDataSource(this, "GetBlogNoDaxLambdaDataSource", { | |
api, | |
lambdaFunction: getBlogNoDaxHandler, | |
description: "Get Blog (no dax) Lambda Data Source", | |
name: "GetBlogNoDaxLambdaDataSource", | |
}); | |
// appsync resolver |