Skip to content

db.load vs orm.express #291

Description

@colegleason

I have a single models.js module that I'd like to load in both Express request handlers and non-Express code. It would be nice if the function definitions for these two cases could be similar so that the models.exports function could be written once well.

Express expects a function with db and models as an argument:

define: function (db, models) {
    models.person = db.define("person", { ... });
}

On the other hand, db.load wants to pass just a callback:

db.load("./models", function (err) {
    // loaded!
    var Person = db.models.person;
    var Pet    = db.models.pet;
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions