photoshelf-storage

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2017 License: MIT Imports: 5 Imported by: 0

README

photoshelf-storage

Build Status Go Report Card Coverage Status MIT License

Image upload server with REST API.

Run Server

Locally

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
Running options
flag description default
c configuration file path
p port number 1323
t storage type boltdb
s storage path ./photos
configuration file

photoshelf-storage can recognized external file.
It needs YAML format

server:
  port: 8080
storage:
  type: file
  path: /path/to/storage
storage type

You can use file or embedded kvs (leveldb or boltdb) to store photos.

Using Docker
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

CRUD photo

Create
curl -X POST http://localhost:1323/photos/ -F "photo=@/path/to/photo"

returns

{
  "id": "identifier"
}
Read
curl -X GET http://localhost:1323/photos/:id

or

Access with browser to http://localhost:1323/photos/:id

Update
curl -X PUT http://localhost:1323/photos/:id -F "photo=@/path/to/new_photo"
Delete
curl -X DELETE http://localhost:1323/photos/:id

License

MIT License

Copyright (c) 2017 Shunsuke Maeda

See LICENSE file

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
mock_service
Package mock_service is a generated GoMock package.
Package mock_service is a generated GoMock package.
domain
model/mock_photo
Package mock_photo is a generated GoMock package.
Package mock_photo is a generated GoMock package.
infrastructure
presentation
mock_controller
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL