Coder Social home page Coder Social logo

Comments (6)

Nargonath avatar Nargonath commented on June 8, 2024

I'm not sure I understand what you mean. Do you mean to choose which part of the server you'd like to decorate i.e decorating something else than the request object?

from hapi-sequelizejs.

samueljoli avatar samueljoli commented on June 8, 2024

@Nargonath Yes, apologies if that wasn't clear.

Ex

server.register([
    {
        register: require('hapi-sequelizejs'),
        options: [
            {
                name: 'dbname', // identifier
                models: ['./server/models/**/*.js'], // paths/globs to model files
                sequelize: new Sequelize(config, opts), // sequelize instance
                sync: true, // sync models - default false
                forceSync: false, // force sync (drops tables) - default false
                decorate  : 'server' // opt to decorate the server object rather than the request interface
            },
        ],
    },
]);

This was inspired by me wanting access to the DB at a server onPreStart extension point, which only allows you access to the server object

from hapi-sequelizejs.

Nargonath avatar Nargonath commented on June 8, 2024

@samueljoli Don't worry no need to apologize. 😉

Alright I see your use case but we would need to allow decorating multiple elements because you're more likely to still need your request decorated as well. I wonder if that would not be the time to look at a better solution for accessing the db object rather than multiplying the decorated interface. It would also come hand-in-hand with #19.

from hapi-sequelizejs.

samueljoli avatar samueljoli commented on June 8, 2024

@Nargonath Ahh thanks, seems like there is a PR for this

from hapi-sequelizejs.

valtlfelipe avatar valtlfelipe commented on June 8, 2024

Released 1.2.0 with #19. Does this solves your problem?

from hapi-sequelizejs.

valtlfelipe avatar valtlfelipe commented on June 8, 2024

Closed due to inactivity. Please reopen if needed.

from hapi-sequelizejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.