Image upload server with REST API.
docker run photoshelf/photoshelf-storage
build executable file.
git clone https://github.com/photoshelf/photoshelf-storage.git
cd photoshelf-storage
dep ensure
go build -o photoshelf-storage
and run
./photoshelf-storage
If you have already set $GOPATH, you can install it with the following command.
go get -u github.com/photoshelf/photoshelf-storage
flag | description | default |
---|---|---|
c | configuration file path | |
p | port number | 1323 |
t | storage type | boltdb |
s | storage path | ./photos |
photoshelf-storage can recognized external file.
It needs YAML format
server:
port: 8080
storage:
type: file
path: /path/to/storage
You can use file
or embedded kvs (leveldb
or boltdb
) to store photos.
git clone https://github.com/photoshelf/photoshelf-storage.git
cd photoshelf-storage
docker build -t photoshelf/photoshelf-storage .
docker run -p 1323:1323 -v $PWD/photos:/photoshelf/photos photoshelf/photoshelf-storage
curl -X POST http://localhost:1323/photos/ -F "photo=@/path/to/photo"
returns
{
"id": "identifier"
}
curl -X GET http://localhost:1323/photos/:id
or
Access with browser to http://localhost:1323/photos/:id
curl -X PUT http://localhost:1323/photos/:id -F "photo=@/path/to/new_photo"
curl -X DELETE http://localhost:1323/photos/:id
MIT License
Copyright (c) 2017 Shunsuke Maeda
See LICENSE file