This project is an Express.js application that provides an API to retrieve image URLs from an AWS S3 bucket and allows downloading of specific images.
- List Images: Retrieve a list of image URLs stored in an S3 bucket.
- Get Image: Download a specific image by its key from the S3 bucket.
- Node.js and npm installed.
- An AWS account with an S3 bucket.
- AWS IAM credentials with permissions to access the S3 bucket.
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Environment Variables: Create a
.env
file in the root of the project with the following content:AWS_ACCESS_KEY_ID=your_access_key_id AWS_SECRET_ACCESS_KEY=your_secret_access_key AWS_REGION=your_region S3_BUCKET_NAME=your_bucket_name PORT=7000 # Optional: set your preferred port
-
Run the application:
npm start
-
Access the API:
- List all images:
GEThttp://localhost:7000/images
- Get a specific image:
GEThttp://localhost:7000/images/:key
Replace:key
with the actual key of the image.
- List all images:
The application handles errors and returns a 500 status code with an appropriate message in case of any issues while retrieving images.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
- AWS SDK for JavaScript - for interacting with AWS services.
- Express.js - for building the web server.
For any questions, feel free to reach out at [your-email@example.com].