https://github.com/ales-tsurko/image_uploader
A demo of a monolithic image uploader server written in Rust
https://github.com/ales-tsurko/image_uploader
Last synced: 3 months ago
JSON representation
A demo of a monolithic image uploader server written in Rust
- Host: GitHub
- URL: https://github.com/ales-tsurko/image_uploader
- Owner: ales-tsurko
- License: unlicense
- Created: 2019-03-03T13:44:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-08T18:35:10.000Z (over 6 years ago)
- Last Synced: 2025-06-01T20:01:16.338Z (4 months ago)
- Language: Rust
- Homepage:
- Size: 969 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://travis-ci.org/AlesTsurko/image_uploader)
# image_uploader
A demo of an image uploader server written in Rust with [actix-web](https://github.com/actix/actix-web).Supports:
- JPEG
- BMP
- GIF
- PNGThe next methods are allowed:
- send binary data directly (single file upload only);
- using multipart/form-data;
- using JSON request with base64 encoded string;
- from destination URL.## Usage
Using docker (will run on port `8000`):
```
$ docker-compose up
```Or install and:
```
$ image_uploader --help
Image Uploader 0.1.0
Ales Tsurko
An image uploader server demo.USAGE:
image_uploader [OPTIONS] --bind_toFLAGS:
-h, --help Prints help information
-V, --version Prints version informationOPTIONS:
127.0.0.1:8000 for ex.
-b, --bind_to
-s, --storage_path Specifies the path where to store the data. If not specified the default one
(./storage) will be used.
```## API
You should properly set the "Content-Type" field of your request's header. The possible values are:
- `image/format` for direct uploads;
- `application/json` for json requests;
- `multipart/form-data` for form-data.For base64 strategy JSON request body model is:
| Name | Type | Example |
| ---- | ---- | ------- |
| `data` | `Array` | |### `PUT /upload`
#### Response
| Name | Type | Example |
| ---- | ---- | ------- |
| `ids` | `Array` | `["936da01f-9abd-4d9d-80c7-02af85c822a8"]` |### `PUT /upload?url=:url`
Uploads an image from the given URL.
#### Response
The same as for `PUT /upload`
### `GET /:id`
Responses with an image.
### `GET /:id?preview`
Responses with an image preview.