hoodiehq / hoodie

:dog: The Offline First JavaScript Backend
Apache License 2.0
4.4k stars 462 forks source link

Turn hoodie into hapi plugin #528

Closed gr2m closed 8 years ago

gr2m commented 8 years ago

at the moment, require('hoodie') returns a method that creates a Hapi instance and passes it to the callback: https://github.com/hoodiehq/hoodie/blob/master/server/index.js

The way we start the Hoodie server at the moment can be seen in bin/start.js

I think it had historical reasons why we ended up with that architecture, and I don’t think it makes much sense any more. Instead, I’d suggest that require('hoodie') will return a hapi plugin and that we instantiate a Hapi instance in bin/start.js instead.

That will also make it simple to use Hoodie in existing architectures. And for some people who don’t want to wait for plugins, they can build their own hapi server with custom routes and add hoodie to the mix.

Any thoughts?

gr2m commented 8 years ago

I’ll look into this as I think it’s pretty straight forward and it will let people extend Hoodie Server more easily without limitations

sebbel commented 8 years ago

Looking forward to this!!

I’ll look into this as I think it’s pretty straight forward and it will let people extend Hoodie Server more easily without limitations

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hoodiehq/hoodie/issues/528#issuecomment-232969916, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2cWO0td7QV-8k8y5Mgge3o9-bz9zufks5qV5v8gaJpZM4JL-rp .

jameswestnz commented 8 years ago

This is ideal - I've done the dirty and used proxyquire to replace some basic functions in the short term. This is going to remove the need for plugins for me in the short term, and will get rid of some of my hacks!