Socket
Socket
Sign inDemoInstall

sequelize-singleton

Package Overview
Dependencies
21
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sequelize-singleton

A simple singleton wrapper for the sequelize ORM, making it easier to configure and build models.


Version published
Weekly downloads
53
decreased by-42.39%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

sequelize-singleton is a simple singleton wrapper for the sequelize ORM, making it easier to configure and build models.

Example Usage:

#app.js
var config = { database: 'db', username: 'user', password: 'password123', opts: {...}};
var orm = require('sequelize-singleton')(config);

orm.sequelize
  .authenticate()
  .complete(function(err){
    if(!!err) {
      console.log('Unable to connect to the database:',err);
    } else {
      console.log('Connection has been established successfully');
    }
  });

Now you can access the sequelize instance wherever you need:

var orm = require('sequelize-singleton')();


...

var User = sequelize.define('User', {
  username: orm.DataTypes.STRING,
  password: orm.DataTypes.STRING
});

...

Keywords

FAQs

Last updated on 21 Jan 2015

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc