Store and retrieve your files without hassle using mongodb gridfs storage engine. Storage service was designed to run on RHMAP, but it can be easly adapted to run on docker and other servers with node.js and npm installed.
- Provide abstraction for data storage
- Allow to store and retrieve any file using simple API
- Use mongodb and gridfs as storage solution
- node 4.4.x
- express
- mongose
See package.json for more information
There are currently some workarounds needed to get the service up and running within RHMAP the platform.
- Make the newly created service public
- Visit the data browser, depending on your application configuration a "Upgrade Database" action will be available, this means the application is using an old/legacy shared database and it needs to be upgraded to use a dedicated one. Note the application needs to be first finished its initial deploy and be running to perform this task.
- Re-deploy the service
- You can now use the service under the "Preview" section of the studio.
Install dependencies
npm install
Execute grunt
grunt serve
POST /api/files/
Upload file using multipart form-data body.
file
Represents binary file that would be uploaded. Example html form element:
<input type="file" name="file"/>
redirectOnSuccess
If added instead of returning json results backend would redirect to path provided as value. Example html form element:
`<input type="hidden" name="redirectOnSuccess" value="/"/>`
Example body containing both parameters:
------WebKitFormBoundaryKKdzzkCch9eo2hG0
Content-Disposition: form-data; name="file"; filename="yourfile.txt"
Content-Type: text/plain
------WebKitFormBoundaryKKdzzkCch9eo2hG0
Content-Disposition: form-data; name="redirectOnSuccess"
/
GET /api/files/:filename
Stream uploaded file. Returns file octet stream
DELETE /api/files/:filename
Delete uploaded file by filename
. Object id can be also specified as filename.
- When using mongo data and files are stored in one place
- Ability to replicate files using mongo mechanisms
- Seamless way to backup data using existing mongo backup solutions
- Possibility to stream data
- Easy to monitor storage and provide alerts
- Possible to manage and query file metadata without effort
See CONTRIBUTING.md