You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hunt-sequilize

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hunt-sequilize

Use Sequilize.js models in Hunt.js application

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

hunt-sequilize

Use Sequilize.js models in Hunt.js framework of v.0.2.0 and higher

Example


    var hunt = require('hunt'),
      huntSequilize = require('hunt-sequilize'),
      Hunt = hunt({
        'sequelizeUrl': 'sqlite://localhost/' //create database in memory
      });
    
    huntSequilize(Hunt); //this it it
    
    Hunt.extendModel('Planet', function (core) {
      return core.sequelize.define('Planet', {
        name: core.Sequelize.STRING
      });
    });
    
    Hunt.on('start', function () {
      Hunt.sequelize.sync().success(function () {
    
        Hunt.model.Planet.create({
          name: 'Earth'
        }).success(function (planet) {
          console.log('Planet "'+planet.name+'" is recorded to database');
          Hunt.model.Planet
            .find({ where: {name: 'Earth'} })
            .success(function (planetFound) {
              console.log('Planet "'+planetFound.name+'" is found to database');
              Hunt.stop();
            });
        });
      });
    });
    Hunt.startBackGround();


Configuration parameters

Only one configuration parameter is accepted - sequelizeUrl. It have to be passed as config object parameter. It can be populated from environmental values of DATABASE_URL (usually used by Heroku PostgreSQL), CLEARDB_DATABASE_URL, or SQL_URL. It can have the following syntax:

Settings for sqlite3 database


   var Hunt = hunt({
     'sequelizeUrl': 'sqlite://localhost/' //create database in memory
   });

   var Hunt = hunt({
     'sequelizeUrl': 'sqlite://localhost/path/to/database.db' //create database in a local file
   });


Settings for MySql database


   var Hunt = hunt({
     'sequelizeUrl': 'mysql://myLogin:myPassword@localhost:3306/myDatabaseName'
   });


Settings for PostgreSQL database


   var Hunt = hunt({
     'sequelizeUrl': 'postgres://myLogin:myPassword@localhost:5432/myDatabaseName'
   });


Keywords

hunt

FAQs

Package last updated on 08 Jul 2014

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