feathersjs-ecosystem / generator-feathers

A Yeoman generator for a Feathers application
https://github.com/feathersjs/feathers
MIT License
120 stars 132 forks source link

sequelize service generator not using es5 classes? #148

Closed eikaramba closed 8 years ago

eikaramba commented 8 years ago

The generic service genrator is using classes. Is there a reason why the sequelize is not using that?

daffl commented 8 years ago

What do you mean? Creating a service using feathers-sequelize does not require any classes at all. The chapter about extending adapters shows how to use several different ways to extend the basic adapter.

eikaramba commented 8 years ago

Please forgive me if my question is silly (i still have problems understanding the "feather way of life"). But isn't https://github.com/feathersjs/generator-feathers/blob/master/generators/service/templates/generic-service.js and https://github.com/feathersjs/generator-feathers/blob/master/generators/service/templates/sequelize-service.js using different notations? I mean both are services, it's just confusing that the generic one is using classes and the sequelize one not. and given your link it is possible to adapt the sequelize to make use of the class to extend it's functionality.

Again this is not a bug and defintely not needed, i'm just looking from a beginner perspective and was confused when i saw 2 (at the first look) different things. It took me a while to understand that you can extend each service and it is just not done by default for the sequelize service template. Is that right?

daffl commented 8 years ago

They are not different. feathers-sequelize just returns a ready to go service object while in the generic service you create your own by creating a class and instantiating it.

As you can see in the feathers-sequelize source it is using the same pattern to implement the generic Sequelize functionality and instantiates it in the default export function which is what is called by the generator.

eikaramba commented 8 years ago

Now i feal dump, and wiser :) Thank you for your explanation. I think i will try to make a blog post or so for beginners like me to explain some feathers.js TIL moments that i had and will still have.

daffl commented 8 years ago

That would be fantastic! When we are working deep down in the code all the time it is easy for us to miss things a beginner might get stumped on. If you write it on Medium we can publish it on blog.feathersjs.com too if you are interested.

eikaramba commented 8 years ago

Absolutely i know exactly what you mean. but i will collect first, really want to be sure that i understood the most basic things first.