Skip to content
A image service with MongoDB GridFS backend.
Go
Branch: master
Clone or download
Latest commit d654ff7 Nov 21, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config first release Nov 21, 2017
health first release Nov 21, 2017
logger first release Nov 21, 2017
.gitignore first release Nov 21, 2017
Dockerfile first release Nov 21, 2017
LICENSE Initial commit Nov 21, 2017
README.md first release Nov 21, 2017
main.go first release Nov 21, 2017

README.md

MongoDB Image Server

An image server based mongodb gridfs.

Installation

$ go get github.com/alsey/mongo-image-server

Connfiguration

Use envionment variables to config this server.

  • PORT0 : port, default is 3000
  • MONGO_ADDR : mongodb address, default is 127.0.0.1:27017
  • MONGO_DB : mongodb database name
  • MONGO_USER : mongodb authenticate user
  • MONGO_PASS : the user's password

How to Use

  1. While some image files saved at mongodb with gridfs format, you can access this images by URL with this server.

The URL is

http://<host>:<port>/images/<filename>
  1. You can change image size by url query parameters while access the image file.
http://<host>:<port>/images/<filename>?w=<width>&h=<height>

The url variables w and h is image's width and height, in pixels.

  1. I wrote a Dockerfile for you, you can make a Docker image, and put it in Kubernetes or Mesos.
$ docker build -t 'mongo-image-server' .
  1. The server includes a health check endpoint for microservice scenario.
http://<host>:<port>/health
http://<host>:<port>/env

License

MIT

You can’t perform that action at this time.