Question: I'm getting `Unhandled rejection TypeError: feed.create is not a function` error and I can't understand why it occurs. What's the problem here?

Here's my code. I'm probably not doing something very fundamental here since I can't reach feed variable in routes/index.js.

If I add module.exports = feed; to my models file, I can reach it, but I have more than one models, so if I add additional models below the feed, they override it.

db.js

```
var Sequelize = require('sequelize');
var sequelize = new Sequelize('mydatabase', 'root', 'root', {
    host: 'localhost',
    dialect: 'mysql',
    port: 8889,

    pool: {
        max: 5,
        min: 0,
        idle: 10000
    },
    define: {
        timestamps: false
    }
});

var db = {};
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;

```

models.js

```
var db = require('./db'),
    sequelize = db.sequelize,
    Sequelize = db.Sequelize;

var feed = sequelize.define('feeds', {
    subscriber_id: Sequelize.INTEGER,
    activity_id: Sequelize.INTEGER
},
{
    tableName: 'feeds',
    freezeTableName: true
});

```

routes/index.js

```
var express = require('express');
var router = express.Router();
var models = require('../models');

router.get('/addfeed', function(req,res) {
    sequelize.sync().then(function () {
        return feed.create({
            subscriber_id: 5008,
            activity_id : 116
        });
    }).then(function (jane) {
        res.sendStatus(jane);
    });
});

```

Answer: 
Just use

```js
const { User } = require("../models");

```
You may want to check the answer given on the link below tackling the same issue, I was able to resolve mine using `const User = sequelize.import('../models/users');`, instead of just `import User from '../models/users';`

[Sequelize create not a function?](https://stackoverflow.com/questions/48875714/sequelize-create-not-a-function)