0.1.2 • Published 4 years ago

@sprdv/hapi-objection v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

hapi-objection

npm version npm downloads npm dependencies code style

Hapi plugin to initialize objection.js and handle database errors.

Installation

hapi-objection can be installed using npm or yarn. This module uses objection but doesn't ship with it.

npm install @sprdv/hapi-objection objection

Usage

This plugin can be registered like any other:

'use strict';

const Hapi = require('@hapi/hapi');

const init = async () => {

    const server = Hapi.server();

    await server.register({ 
        plugin: require('@sprdv/hapi-objection'), 
        options: {
            knex: {
                client: 'sqlite3',
                connection: {
                    filename: ':memory:'
                }
            }
        } 
    });

    await server.start();
    console.log('Server running on %s', server.info.uri);
};

init();

Options

The following options are available:

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago