0.1.13 • Published 2 years ago

moleculer-db-adapter-couchdb-nano v0.1.13

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

Moleculer logo

moleculer-db-adapter-couchdb-nano NPM version

CouchDB Nano adapter for Moleculer DB service.

Features

  • Schemaless adapter
  • CouchDB Nano driver v7

Install

$ npm install moleculer-db moleculer-db-adapter-couchdb-nano --save

Usage

"use strict";

const { ServiceBroker } = require("moleculer");
const DbService = require("moleculer-db");
const CouchDBAdapter = require("moleculer-db-adapter-couchdb-nano");

const broker = new ServiceBroker();

// Create a CouchDB service for `blog-post` entities
broker.createService({
    name: "blog",
    collection: "posts",
    adapter: new CouchDBAdapter("couchdb://localhost:5984"),
    mixins: [DbService]
});

broker.start()
// Create a new post
.then(() => broker.call("posts.create", {
    title: "My first post",
    content: "Lorem ipsum...",
    votes: 0
}))

// Get all posts
.then(() => broker.call("posts.find").then(console.log));

Options

Example with default connection to localhost:5984

new CouchDBAdapter()

Example with connection URI & options

new CouchDBAdapter("couchdb://localhost:5984", {
    //any opts supported by Nano
})

Test

$ npm test

In development with watching

$ npm run ci

License

The project is available under the MIT license.

Contact

Copyright (c) 2018 Mr. Kutin

0.1.13

2 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago