1.5.1 • Published 8 years ago

loopback-component-storage-mongo v1.5.1

Weekly downloads
24
License
ISC
Repository
-
Last release
8 years ago

loopback-component-storage-mongo

Build Status codecov.io Dependency Status

codecov.io

LoopBack storage mongo component provides Node.js and REST APIs to manage binary contents using Mongodb gridfs

Installation

Install the storage component as usual for a Node package:

  npm install --save loopback-component-storage-mongo

Using it

Edit you datasources.json and add the following part

"gridfs": {
  "name": "gridfs",
  "connector": "loopback-component-storage-mongo",
  "host": "localhost",
  "port": 27017,
  "database": "test"
}

And the you can use it as a datasource of your model.

API

DescriptionContainer model methodREST URI
List all containersgetContainers(callback)GET /api/
Get information about specified containergetContainer(container, callback)GET /api//:container
Create a new containercreateContainer(options, callback)PORT /api/
Delete specified containerdestroyContainer(options, callback)DELETE /api//:container
List all files within specified containergetFiles(container, callback)GET /api//:container/files
Get information for specified file within specified containergetFile(container, file, callback)GET /api//:container/files/:file
Delete a file within a given container by nameremoveFile(container, file, callback)DELETE /api//:container/files/:file
Upload one or more files into the specified containerupload(container, req, res, callback)POST /api//:container/upload
Download a file within specified containerdownload(container, file, res, callback)GET /api//:container/download/:file