Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-nano

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-nano

Provide req.nano, passing session cookies to CouchDB and back again.

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

connect-nano Build Status

Provide req.nano, passing session cookies to CouchDB and back again.

Getting Started

Install the module with: npm install connect-nano

var connect = require('connect');
var nano = require('connect-nano');

var app = connect()
  .use(connect.cookieParser())  // connect-nano depends on cookieParser
  .use(nano('http://localhost:5984'))
  .use('/login', function(req, res) {
    req.pipe(req.nano.request({
      method: 'post',
      path: '_session',
      content_type: 'application/x-www-form-urlencoded; charset=utf-8'
    })).pipe(res);
  })
  .use('/session', function(req, res) {
    req.nano.request({ path: '_session' }).pipe(res);
  })
  .use('/me', function(req, res) {
    req.nano.request({ path: '_session' }, function(err, data) {
      if (err) {
        return res.end(err);
      }
      req.nano.use('_users').get('org.couchdb.user:' + data.userCtx.name).pipe(res);
    });
  })
  .listen(3000);

Options

connect-nano passes configuration directly over to nano(), see nano configuration.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

  • Lint your code via npm run jshint.
    • And test your code with nodeunit via npm test.

License

Copyright (c) 2013 null2 GmbH, Johannes J. Schmidt
Licensed under the MIT license.

Keywords

FAQs

Package last updated on 29 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc