Closed jbewing closed 3 years ago
This PR adds three new endpoints for the Image API to the Flask server:
GET /api/images
[ { "href": "/api/images/{id}", "title": "<imageTitle>" # title that the image is uploaded with } ... ]
GET /api/images/{id}
POST /api/images
{ "status": "created", "href": "/api/images/<imageId>" }
Note: the file format isn't necessarily restrictive to images at this point. Tbh, you could just use this as a BLOB storage like S3.
# I've run the following poetry run flask run curl -F "image=@/Users/jbewing/Desktop/a_golden_retriever.jpeg" 127.0.0.1:5000/api/images
And verified that http://127.0.0.1:5000/api/images returns
[{"href":"/api/images/1","title":"a_golden_retriever.jpeg"}]
and http://127.0.0.1:5000/api/images/1 returns
Related Issues: https://github.com/brodigan-e/capstone-POV/issues/4 https://github.com/brodigan-e/capstone-POV/issues/5 cc @DarkAce65
This PR adds three new endpoints for the Image API to the Flask server:
GET /api/images
which returns a list of all images stored in the DB with the following body:GET /api/images/{id}
-> returns the image itselfPOST /api/images
-> accepts file upload input and returns a 201 with the following body:Note: the file format isn't necessarily restrictive to images at this point. Tbh, you could just use this as a BLOB storage like S3.
Testing
And verified that http://127.0.0.1:5000/api/images returns
and http://127.0.0.1:5000/api/images/1 returns
Related Issues: https://github.com/brodigan-e/capstone-POV/issues/4 https://github.com/brodigan-e/capstone-POV/issues/5 cc @DarkAce65