Closed keon closed 8 years ago
Thanks for your suggestion. I saw the Graffiti for a while but didn't look at it in details. It seems to be used when you already have your existing models and you don't want to rewrite everything from scratch. So, you could embrace Graffiti middleware in order to convert your existing models into a GraphQL schema and exposes it over HTTP. I didn't see how it fits in our project.
@keonkim @lvarayut you should have a look at this repo https://github.com/RisingStack/graffiti-mongoose
@lvarayut thats true graffiti doesn't really fit in this project but mongoose at least for the login and signup part of it in way that works with relay and graphQL, thanks
I personally think purposely leaving out dictated data storage is part of what makes this repo so valuable. How you start up a React/Relay project will more or less be the same every time, but how you store the data will change a lot depending on intricacies of the project itself. I think if you want boilerplate Mongo code blended in you should fork or make a Mongo branch.
@jamesroseman node.js server projects almost always go with mongo (at least in my experiences). For example, MEAN stack included mongodb boilerplate as their storage and this was what made it so popular. But at the same time I also think that it should be modularized so that users can easily change their storage backend. More thoughts?
Both of you have valid points. That's why I'm trying to include the database as an option, by using Yeoman. So, people can choose whether or not they want to include the database. Even better, we could provide many database options; MongoDB, Postgresql, and MySQL, in the generator.
@lvarayut I'd also urge you to include the option to keep it reading from database.js
, so that if you were to use a more esoteric approach (I'm working on apps that use RethinkDB, Firebase, some that rely on other app's APIs as their data source) you could still easily spin up a project and unplug the current data dependency.
MongoDB, Mongoose, and Graffiti all work perfectly well when used with GraphQL. the mongoose schema using MongoDB and Mongoose would look like the one I did in the fork.