Rust server for upload images.
You can run up the app via docker, just enter in terminal:
docker-compose up
After run, the server starts on localhost:8000. The server have got one endpoint http://localhost:8000/api/v1/images/upload which accepts application/json, text/plain or multipart/form-data content type
All files store in /tmp directory. The app automatically create uploaded_files folder in the tmp directory and save all files into this folder. You can replace the tmp directory on own folder via STOREDIR environment variable. Just change the environment variable in the docker-compose.yml file
Send one binary file:
curl -X POST -H "Content-Type: image/jpeg" --data-binary "@./tests/dataset/jpg.jpg" http://localhost:8000/api/v1/images/upload
Send one file as base64:
base64 ./tests/dataset/png.png | curl -X POST -H "Content-Type: text/plain" -d @- http://localhost:8000/api/v1/images/upload
Send one url:
curl -X POST -H "Content-Type: text/plain" -d "https://cdn.pixabay.com/photo/2018/01/14/23/12/nature-3082832_960_720.jpg" http://localhost:8000/api/v1/images/upload
Send JSON (Array<string>) with base64:
cat ./tests/dataset/json.json | curl -X POST -H "Content-Type: application/json" -d @- http://localhost:8000/api/v1/images/upload
Send multipart/form-data, multiple files (binary, base64, or url or all together):
curl -X POST -H "Content-Type: multipart/form-data" -F 'files[]=https://cdn.pixabay.com/photo/2018/01/14/23/12/nature-3082832_960_720.jpg' -F 'files[]=@./tests/dataset/png.png' -F "files[]=`cat ./tests/dataset/jpg.base64`" http://localhost:8000/api/v1/images/upload