This TypeScript API allows users to upload and retrieve images.
- Method:
POST
- Endpoint:
/upload
- Content-Type:
multipart/form-data
name
(type: string) - The name associated with the image.Image
(type: file) - The image file to be uploaded.
201 Created
: Image uploaded successfully.- Response Format: JSON
- Example:
{ "success": true, "message": "Image uploaded successfully", "data": { "id": "12345" } }
200 OK
: No file provided.- Response Format: JSON
- Example:
{ "error": "No file provided" }
200 OK
: Invalid file type. Only JPG, PNG, and GIF are allowed.- Response Format: JSON
- Example:
{ "error": "Invalid file type. Only JPG, PNG, and GIF are allowed." }
500 Internal Server Error
: Error uploading image.- Response Format: JSON
- Example:
{ "error": "system error" }
- Method:
GET
- Endpoint:
/get_image/:pictureId
pictureId
(type: string) - The ID of the picture to retrieve.
200 OK
: Image retrieved successfully.- Response Format: JSON
- Example:
{ "imageUrl": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD/4QA..." }
200 OK
: Invalid pictureId format.- Response Format: JSON
- Example:
{ "error": "Invalid pictureId format" }
200 OK
: Image not found.- Response Format: JSON
- Example:
{ "error": "Image not found" }
500 Internal Server Error
: System error.- Response Format: JSON
- Example:
{ "error": "system error" }
Feel free to use this TypeScript-specific documentation as a starting point and customize it further based on your specific needs.