This service renders the interactive photo grid element for the AirBnb clone app.
Clone the repo and from the root folder of the project run thge below command:
npm install
Create .env file in root of the project with below structure and replace values as per your AWS account:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
AWS_BUCKET_NAME=
Then, from command line from the root directory (for the .env file to be recognized):
npm run seed
This will create 5 photos for each room => 500 entries in DB and S3 bucket => ~ 5-10 minutes execution time
-
Retrieve all photos from room: endpoint:
/rooms/:id/getPhotosByRoomIdRequest Type:GET -
Create photo: endpoint:
rooms/addRoomPhotoRequest Type:POSTRequired Headers: 'Content-Type' : 'application/json' Required Body:
room_id: 'Number',
name: 'String',
caption: 'String',
storage_url: 'String'
}
Update Room photo:
endpoint: /rooms/updateRoomPhoto
Request Type: PUT
Required Headers: 'Content-Type' : 'application/json'
Required Body:
room_id: 'String',
_id: 'String'
Optional: Add any properties you wish to update...
Delete Room photos:
endpoint: /rooms/deleteRoom
Resuest Type: DELETE
npm start