AWS JavaScript SDK v2 Snippets
A collection of useful snippets for working with AWS SDK v2 (S3 and DynamoDB), Express, and EJS in Node.js applications.
Features
- AWS Configuration: Quick setup for S3 and DynamoDB DocumentClient.
- Data Persistence: Standard CRUD operations using DynamoDB.
- File Management: S3 image upload integration with Multer.
- View Templates: Prepared EJS structures for listing and editing data.
Usage
Type the following prefixes in any JavaScript or EJS file to see the available snippets:
Core Files
cafe-aws: Setup config/aws.js.
cafe-model: Core logic in models/*.js.
cafe-controller: Logic handlers in controllers/*.js.
cafe-routes: Express routing in router/*.js.
cafe-index: Main dashboard view (views/index.ejs).
cafe-edit: Edit form view (views/edit.ejs).
cafe-app: Minimal index.js setup.
Specialized Functions
- Model Layer:
cafe-model-getAll, cafe-model-getOne
cafe-model-create, cafe-model-update, cafe-model-delete
cafe-model-validate, cafe-model-uploadImage
- Controller Layer:
cafe-controller-getAll, cafe-controller-create
cafe-controller-editForm, cafe-controller-update, cafe-controller-delete
Requirements
Ensure the following packages are installed in your project:
express, ejs, aws-sdk, multer, dotenv, crypto.
| |