1.0.0 • Published 7 years ago

fileexpress v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

fileexpress

fileexpress is an express (4+) router that acts as a drop-in REST API to allow file storage and listings backed by MongoDB's GridFS functionality. It supports organizing files by an owner, and has customize-able authorization.

Files can be uploaded via put/post (you need to have a suitable form parser - ie. busboy. Note the parser you use must support multi-part form requests (so... body-parser doesn't work). Files are retrieved by owner or by file id, along with file meta data, and can be removed with delete calls.

Installation

npm install fileexpress

Usage

The module exports a factory method that is used to create an express 4 router. Simply plug this into your app and you are ready to go. The factory method requires you to pass in an instance of the mongo driver, along with the opened database.

var fx = require('fileexpress');

... create mongo connection ...

var app = express();
... setup express ...

router = fx.make_router(mongo, db);
app.use('/', router);

app.listen(3000);

Examples

var app = express();
var bb = require('express-busboy');


bb.extend(app, {
  upload: true,
  path: 'test/files/uploads'
});

router = fx.make_router(mongo, db);
app.use('/', router);

app.listen(3000);
1.0.0

7 years ago

0.0.8

7 years ago

0.0.7

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago