- Require starting MongoDB
- Create
api/.envadd MONGO_URL - Run
npm installto install the dependency - Add one Pokemon into the database manually following the
api/sampleData/pokemon.jsfile. - Sample images are in the
api/sampleDatafolder - Run
npm startto start the app locally on PORT 5000
- Run
npm installto install the dependency - Run
npm startto start the app on PORT 3000
Create an S3 Bucket to host Pokemon images
- ensure that images is not accessible by public first
- add a bucket policy to allow read only permission
Update the Pokemon data in the database to display images on React App. The express app should return the data with s3 URL for images.
Create a Policy for write permission
putObjectCreate a Group in IAM and add the newly created Policy
Create a User and add user to the Created Code.
Install the
aws sdkon node jsadd environment vairable
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandBUCKET_NAME. Be sure not to commit the environment variables and NOT to share it.Create a function to get
presignedUrlfrom s3.Create a route that returns the
presignedUrlOn React, upload the image to S3 and get back the URL in
config.urluseaxios.putmethodCall
axios.postto create a Pokemon with the image URL.Try Creating new Pokemon, verify the image is on S3 and verify the Pokemon are showing in the gallery.