# hapi-linvodb

> Hapi plugin for using linvodb3

Latest version **1.0.1** (published 2016-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install hapi-linvodb
pnpm add hapi-linvodb
yarn add hapi-linvodb
bun add hapi-linvodb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-02-11 |
| First published | 2016-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mikhail Delport |
| Maintainers | lokenx |

## Links

- npm: https://www.npmjs.com/package/hapi-linvodb
- Repository: https://github.com/lokenx/hapi-linvodb
- Homepage: https://github.com/lokenx/hapi-linvodb#readme
- Issues: https://github.com/lokenx/hapi-linvodb/issues
- npm.io page: https://npm.io/package/hapi-linvodb

## Dependencies (4)

- [joi](https://npm.io/package/joi.md) ^7.2.3
- [hoek](https://npm.io/package/hoek.md) ^3.0.4
- [linvodb3](https://npm.io/package/linvodb3.md) ^3.13.0
- [leveldown](https://npm.io/package/leveldown.md) ^1.4.4

## Recent versions

- 1.0.1 (latest) — 2016-02-11
- 1.0.0 — 2016-02-11

## README

# hapi-linvodb [![Build Status](https://travis-ci.org/lokenx/hapi-linvodb.svg?branch=master)](https://travis-ci.org/lokenx/hapi-linvodb) [![codecov.io](https://codecov.io/github/lokenx/hapi-linvodb/coverage.svg?branch=master)](https://codecov.io/github/lokenx/hapi-linvodb?branch=master) [![npm version](https://badge.fury.io/js/hapi-linvodb.svg)](https://badge.fury.io/js/hapi-linvodb)

Simple [Hapi](http://hapijs.com/) plugin for [linvodb3](https://github.com/Ivshti/linvodb3)

# Installation

```
npm install hapi-linvodb
```

# Usage

```js
'use strict';

const Hapi = require('hapi');

// Create a server with a host and port
const server = new Hapi.Server();

server.connection({
    host: 'localhost',
    port: 8000
});

server.register({
    register: require('hapi-linvodb'),
    options: {
      modelName: 'test',
      filename: 'testlinvo.db',
      schema: {}
    }
}, (err) => {

    server.route({
        method: 'GET',
        path: '/',
        handler: (request, reply) => {

            // Access plugin
            var db = server.plugins['hapi-linvodb'].db;

            // Use requests database and create requests database if it does not exist
            db.insert({ a: 1 }, (err, doc) => {

                reply({ message: 'request added to database' });
            });

            // If using a schema you have to create a new object otherwise it's ignored
            const user = new db({});
            user.name = 'Adam';

            user.save(() => {

              reply({ message: 'request added to database' });
          });

        }
    });
});

// Start the server
server.start(() => {

    console.info(`Hapi times at ${server.info.uri}`);
});
```

# License

MIT 2016

---
_Source: https://npm.io/package/hapi-linvodb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
