A simple LevelDB plugin for Hapi.
Note: Sublevel has been updated to v6 in version
3.0.0 which has breaking changes which will corrupt a pre version 6 database, read about the sublevel breaking changes before updating, there is a migration tool to help with the upgrade.
Register plugin as follows, an optional options object can be passed in to specify data storage location 'path', and the config object supports all LevelUp options:
const Hapi = ;var server = Hapi;server;server
To use plugin:
// New in 5.0: Make sure either `server.initialize()` or `server.start()` has been called// to have access to the db reference// Accessing level objectconst db = requestserverplugins'hapi-level'db; // access from a request object// orconst db = pluginplugins'hapi-level'db; // access in a hapi plugin// Usage works just like LevelDB woulddb;});// Sublevel is also available to use for sectioning of data, similar to SQL tablesusers;});