Socket
Book a DemoInstallSign in
Socket

hapi-nedb-connector

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-nedb-connector

A simple connector for hapi and nedb

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-nedb-connector NPM version Build Status

A simple connector for hapi and nedb

Installation

npm install hapi-nedb-connector

Usage

var Hapi = require('hapi');

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

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

server.register({
	register: require('hapi-nedb-connector'),
	options: {
		directory: 'data/'
	}
}, function (err) {

	server.route({
		method: 'GET',
		path: '/',
		handler: function (request, reply) {
			// Access plugin
			var db = server.plugins['hapi-nedb-connector'].db;
			
			// Use requests database and create requests database if it does not exist
			db('requests').insert(request.info, function(err, newRequest) {
				reply({message: 'request added to database'});
			});

		}
	});
});

// Start the server
server.start(function() {
     console.log('Server running at:', server.info.uri);
});


Keywords

hapi

FAQs

Package last updated on 02 Sep 2015

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.