Data is stored in an s3 bucket that is queried to obtain, delete, or store images. There is a prexisting bucket that is hardcoded into the application, though you may replace that if you wish, otherwise, you may contact me for the access keys at abrahamp@oregonstate.edu or via discord #daughterOfSpring.
add access credentials to config.json
add s3 bucket name to .env
npm install
npm start
Responses are all the JSON component of the response body.
GET /image/list
Gets a list of all the filenames in the s3 bucket.
Request - fetch('localhost:3001/image/list');
Response - {"files": ["filename.jpg", "otherFile.jpg", "thirdOne.jpg"]}
GET /image/random
Retrieves a random image from the s3 bucket.
Request - fetch('localhost:3001/image/random');
Response - {"url": "file/location/inS3/filename.jpg" }
GET /image/{fileName}
Retrieves a specific image from the s3 bucket.
Request - fetch('localhost:3001/image/fileName.jpg');
Response - {"url": "file/location/inS3/filename.jpg" }
DELETE /image/{fileName}
Deletes an image from the s3 bucket.
Request - fetch('localhost:3001/image/fileName.jpg', {method: "DELETE"});
Response - {"message": "File deleted successfully"}
POST /image/upload +++
BODY - multipart/form-data - file object to be uploaded
Stores a new image in the s3 bucket.
Request - fetch('localhost:3001/image/upload', {method: "POST", body: formData});
Response - {"message": "File uploaded successfully: file/location/inS3/filename.jpg" }


