Skip to content

An express module that attaches a file upload api to your express application

Notifications You must be signed in to change notification settings

warrensplayer/express-couchFs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-couchFs

A express module that provides a simple file upload api using couchDb as file storage.

Usage

var couchFs = require('express-couchdb-fs');

app.configure(function() {
  app.use(couchFs({couch: 'http://localhost:5984/fs'}));
});

Alternate Configuration

If you would like to dynamically change which database is being used, then use the following configuration and set the request parameter given to the name of the database to use. The database_parameter_name is optional and will default to "COUCH_DB".

app.use(couchFs({url: 'http://localhost:5984/', database_parameter_name: 'COUCH_DB' }));

API

POST /api/file

The post statement can be a FORM Post or XHR2 post, the important aspect is that the body contains a file field named: uploadFile

On Success, this returns the couchdb generated document response:

{
  ok: true,
  id: xxxxx,
  rev: xxxx
}

GET /api/file/:id

Grabs the file and downloads it to the client with a save as dialog.

DELETE /api/file/:id

About

An express module that attaches a file upload api to your express application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%