title: How correct create new entry in Sequelize.js ORM?
body: <p>I use <strong>Sequelize.js</strong> ORM in my Node.js application.</p>
  
  <p>When I try to create new user by <code>/create</code> url it raise me error.</p>
  
  <p>Error message: <code>TypeError: User.create is not a function</code></p>
  
  <p>Where I did mistake?</p>
  
  <p><strong>models/user.js</strong>:</p>
  
  <pre><code>'use strict';
  
  const bcrypt = require('bcrypt-nodejs');
  
  module.exports = (sequelize, DataTypes) =&gt; {
      const User = sequelize.define('User', {
          email: DataTypes.STRING,
          password: DataTypes.STRING,
          first_name: DataTypes.STRING,
          end_name: DataTypes.STRING,
          active: DataTypes.BOOLEAN,
          admin: DataTypes.BOOLEAN
      }, {
          timestamps: false,
          createdAt: false,
          updatedAt: false,
      });
      User.beforeSave((user) =&gt; {
          if (user.changed('password')) {
              user.password = bcrypt.hashSync(user.password, bcrypt.genSaltSync(10), null);
          }
      });
      User.prototype.comparePassword = function (password, cb) {
          bcrypt.compare(password, this.password, function (err, isMatch) {
              if (err) {
                  return cb(err);
              }
              cb(null, isMatch);
          });
      };
      return User;
  };
  </code></pre>
  
  <p><strong>routes/user.js:</strong></p>
  
  <pre><code>const express = require('express');
  const router = express.Router();
  
  const User = require('../models/user');
  
  router.post('/create', function(req, res) {
      console.log(req.body);
      if (!req.body.email || !req.body.password) {
          res.status(400).send({
              msg: 'Please enter email and password.'
          });
      } else {
          User.create({
              email: req.body.email,
              password: req.body.password,
              first_name: req.body.first_name,
              last_name: req.body.last_name,
              active: req.body.active,
              admin: req.body.admin
          }).then((user) =&gt; res.status(201).send(user)).catch((error) =&gt; {
              console.log(error);
              res.status(400).send(error);
          });
      }
  });
  
  module.exports = router;
  </code></pre>