### Build and Install Fastify Plugin Dependencies Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md This snippet outlines the commands required to build the `fastify-aws-dynamodb-cache` package and install its necessary dependencies from the root directory. ```shell npm run pack:local npm install ``` -------------------------------- ### Run Local Fastify Test Server Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md This snippet provides the commands to navigate into the `local_testing` directory and start the Fastify test server, which uses the locally packaged plugin. ```shell cd local_testing npm run start ``` -------------------------------- ### Install fastify-aws-dynamodb-cache Package Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md This snippet provides the command to install the `fastify-aws-dynamodb-cache` package using npm. This is the initial step required to integrate the plugin into your Node.js project. ```shell npm install @blastorg/fastify-aws-dynamodb-cache ``` -------------------------------- ### Configure Fastify with DynamoDB Cache Plugin Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md This example demonstrates how to register and configure the `fastify-aws-dynamodb-cache` plugin with a Fastify application. It shows the necessary parameters for connecting to DynamoDB and how to enable caching for specific API endpoints, including setting a default TTL and overriding it per route. ```ts import Fastify from "fastify"; import { dynamodbCache } from "@blastorg/fastify-aws-dynamodb-cache"; const fastify = Fastify().register(dynamodbCache, { dynamoDbRegion: "", // AWS region of your choice. dynamoDbAddress: "http://localhost:8000", // Optional! If you are hosting your own instance of Dynamo (locally or cloud), then specify the ip address of the database here. tableName: "fastify-dynamodb-cache", // DynamoDB table name defaultTTLSeconds: 30, // Default TTL (seconds), which would be used if no TTL is specified on the endpoint. disableCache: true // Optional! If you want to disable caching from being set on endpoints, you can set this to true. Set it to false or leave it empty to enable cache. }); fastify.get( "/", { config: { cache: { cacheEnabled: true, // Set to true if endpoint responses should be cached. If you don't want to cache responses set it to false, or don't specify it. ttlSeconds: 10 // Optional! TTL on the cached value } }, schema: {} }, async (_, res) => { // handler... return res.status(200).send({}); } ); ``` -------------------------------- ### Update and Re-test Fastify Plugin Changes Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md After making modifications to the plugin, these commands are used to re-package the plugin and restart the test server to reflect the latest changes. ```shell npm run pack:local npm run start ``` -------------------------------- ### Define Conventional Commits Message Structure Source: https://github.com/blastorg/fastify-aws-dynamodb-cache/blob/main/README.md This snippet illustrates the required format for commit messages, adhering to the Conventional Commits specification, including type, optional scope, description, body, and footers. ```git [optional scope]: [optional body] [optional footer(s)] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.