Read this in other languages: 日本語
- Node version 16 or higher is required
- To get started with Momento you will need a Momento API key. You can get one from the Momento Console.
To run any of the examples you will need to install the dependencies once first:
npm install
This example demonstrates a basic set and get from a cache.
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run basic
Example Code: basic.ts
This example demonstrates several slightly more advanced concepts, including:
- creating and listing caches
- deleting a key
- issuing multiple concurrent get requests
- using the Middleware API to wrap requests
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run advanced
Example Code: advanced.ts
This example demonstrates how to use the dictionary data type.
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run dictionary
Example Code: dictionary.ts
This example demonstrates how to use the batchSet
, batchGet
, and batchDelete
functions.
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run batchutils
This example demonstrates how to use the Leaderboard functions.
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run leaderboard
If you have questions or need help experimenting further, please reach out to us!
For more info, visit our website at https://gomomento.com!