-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL support #214
Comments
Hi @glutengo , it's wonderful! Here the configuration and the entity TypeORM main files of generated example app:
Here the blueprint prompt point of database choice: However, I advice to wait the next NHipster 2.0.0 release (a beta will be published in the next days after #211 validation) and fork that main branch. For any questions feel free to contact me, I'm the full NHipster contributor (the main founder and stream lead), so there will be wonderful to collaborate together! |
Hi @amanganiello90 thank you so much for your quick reply and thank you for all the pointers! I have worked with NestJS and TypeORM in the past and the docs have their own graphQL section: https://docs.nestjs.com/graphql/quick-start As far as I understand, using GraphQL would not be an alternative to using a certain database (type) like mysql or mongodb but it would rather be an alternative/addition to using REST, right? Also thank you for offering your support, I will definitely get in touch again. |
Yes, the link section of NestJS that I have added in my comment is the same yours :) However, when you customize the entity model template, you can define your service called by the controller REST api, so in my opinion when the user chooces the graphQL database automatically He will use your custom services and models (and you could add new questions after graphQL choice if there are other customization for the user). For the JDL, if you need to specify an annotation to generate entity and services customization for GraphQL, you could use the jhipster standard databaseType. For example in NHipster I defined the sqlite value in devDatabaseType: https://github.com/jhipster/generator-jhipster-nodejs/blob/main/test-integration/samples/microservice-oauth2-jdl/.yo-rc.json You could perform the same thing in JDL, and evaluate in the blueprint the different generation according the variable value. Finally, you could give a look to the graphQL official jhipster module. |
@glutengo yes you are right, maybe it's more correct to add another question to chooce graphQL support in server subgenerator prompt because it enables api that you can use with all database types (sqlite, sql and so on). However you will have customized templates for entity model, service and controller according your choice. These templates will be in entity-server subgenerator, called automatically by import-jdl command or entity command. |
@amanganiello90 I agree and thanks for pointing out the existing jhipster module, that seems to be brand new and I had not seen that yet! I was already typing and trying to make my case for not using the databaseType field but your latest comment shows we are on the same page now :) |
@glutengo you rock !!! 💯 ;) |
@mraible @amanganiello90 Thank you a lot for that! It will be a while until I can provide a fully working version of this, but I will keep you updated with my work here. So far I have managed to set up the NestJS GraphQL module during app generation, create a GraphQL resolver for the user entity and generate a GraphQL resolver when a new entity is created via the entity generator. I have also taken some basic steps on the frontend side with Angular, but there is still plenty to do on that end. I am also considering to move the code to its own module (instead of integrating it into this blueprint). The new module could be compatible with the Node.js backend in the first version and could be extended to be working with Spring in the backend (or any other technology - if someone decides to implement it) at some point in the future too. As I am planning to generate the frontend code for consuming the GraphQL API too, I think it would be best to have an own module because otherwise the frontend code (which could also be of use for JHipster flavours other than Node.js) would be locked away in this blueprint and could not be re-used anywhere else. |
It is possible to have the entity backend part (nodejs) in the blueprint, and the frontend (i.e. Angular) in a module? |
My work for the GraphQL integration is continued as a JHipster module here: It is still very much work in progress, I just wanted to give a quick update so that you know where the work is continued. |
Thanks @glutengo!! |
First early version is now available: https://www.npmjs.com/package/generator-jhipster-gql |
Good!! |
Hi @glutengo. You can get your bug bounty if the issue is completed. So I close the issue. Thanks |
Overview of the issue
Picking up from jhipster/generator-jhipster#4251 (comment)
I have decided to work on a GraphQL integration for nhipster in my master's thesis. I will start to work on this soon and I would like to hear the opinion of the developer team regarding the best approach on how to integrate my work in the jhipster ecosystem.
My initial idea was to create an own blueprint. This new blueprint would have generator-jhipster-nodejs as a dependency and add the new graphQL functionality where needed (using inheritance where possible). Would this be the right way to go? What other options are worth looking at? A PR in this project? A module rather than a blueprint?
Looking forward to hearing your thoughts!
Related issues
jhipster/generator-jhipster#4251
The text was updated successfully, but these errors were encountered: