Graphql, way to organize entities into tree shema - node.js

Yo hello,
pretty new into graphQl game, but I was wondering, is there way how to organize entities into tree schema similar to how swagger doing it? Using apollo server for UI/ debbuging of my graphQl.
Somehow turn this:
Into this:
Thanks for any help or suggestions...
Using it on nodejs/ typescript, grapql, graphql-modules, prisma... Dunno if it's important.

I dont think it is possible with current graphQL schema specification.
You can try using this instrument to convert grapqhQL to openApi schema, and then edit it to add grouping. It is hardly a good solution but might help, depending on your purpose.

Related

Defining API class in component based structure

I have been reading the 'Node JS Best Practices' Github article. One point that I I found interesting was the very first best practice. Here they split up the project structure based on components. One of the advises was to use functions and classes outside the component by defining them in an API class. But I can't find any examples on how such class should be build.
This is the link to the Github article:
Component bases project structure
You Just Connect Your Main Index file .
every script File Then AutoLoad Practices.
Var myVar2 = require('./your_file')
You can have a look at this, if you wanna structure your project in different parts and make that more readable.
Im attaching one of the boilerplate link of github since, it will be huge to tell you everything here, just look at this setup you will know everything.
check this link for boilerplate.
If you have doubts let me know.

Where to find these fields in Github's GraphQL library?

I am trying to get these two fields.
required_pull_request_reviews.users.login and
required_pull_request_reviews.teams.name
from the original REST API:
/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
But in GraphQL I cannot seem to find where this information is.
I have next to no experience with GraphQL, so it is quite possible that I am missing something obvious.

Using d3.js, mongoose, mongoDB, express properly

I'm really new to node.js and I've been reading a lot of tutorials and documentation on node.js, mongoose, mongoDB, Express, etc and I feel I'm still not getting something.
I want to make a website where data is generated by querying mongoDB and then results are returned to browser where it is visualized in d3.js.
I currently have a graph in d3 as a separate JS file (jdriver.js) called in the head of my jade file. My jdriver.js file is very self-contained in that it generates all the buttons, filters, sliders, etc.). However I'm not sure how I could go about, say if I want to apply a filter -> query mongodb -> have mongodb return a JSON data file -> redraws with new data.
And then how to fit all of that within the framework provided by Express?
Would someone be as kind to either point me to some sources or help me out?
Thanks so much.

What's a good node.js / mongoose form builder?

From using other frameworks I've gotten used to not building out and mapping forms to db objects manually. Since using node.js and mongoose. I'm looking for a form builder that allows the following:
automatically maps mongoose objects to form fields
handles both 'new' and 'update' use cases
allows class injection around form fields for styling
includes validation
allows one to add custom fields
Does anyone know of any such form builders for node.js, express, mongoose?
I haven't used it, or looked at it in depth, but https://github.com/oJshua/mongoose-forms looks like it may be of interest.
I know this is kind of old discussion but I just wanted to recommend checking out Formage (npm: formage)
https://github.com/Empeeric/formage
Setup is easy and straightforward. You can check it out in matter of minutes and hopefully this can help you.

Using Solr for indexing and search with Mongodb and nodejs

Does anyone have any experience with this particular stack? I'm working on a web project that will eventually contain an extremely large amount of data and was trying to get Solr to play nicely with some simple Mongodb entries but I have found little to no information about it. I found this: http://blog.knuthaugen.no/2010/04/cooking-with-mongodb-and-solr.html which is mongodb + solr + php, but I'm struggling to see how I would use node similarly. Anybody have any insight? I'd greatly appreciate it. If this is a dumb thing to try to implement, feel free to let me know as well!
Found this library: https://github.com/tjgillies/node-lucene
Doesn't look like there is much documentation there but I'll give it a go.
Update:
So a quick fix (not ideal) that worked was to use a Perl module for lucene and then using the child process functionality in Node.js, I was able to insert and search for my data inside of lucene. So for a workaround, it does the trick.
Probably as of Sep 2012, you would want to take a look at this.
https://github.com/lbdremy/solr-node-client
Good documentations http://lbdremy.github.com/solr-node-client/ (though I didnt liked the web fonts used) but seems VERY promising.
This project looks promising: https://github.com/gsf/node-solr. Not a whole lot of docs, but the tests are promisingly descriptive.
Then you would maybe do something like this in your mongoose schema:
schema.pre('save', function (next) {
// this will be triggered when your mongoose schema object is saved
// TODO add to a queue that sends the documents to SOLR in e.g. batches
// of 2000
});
http://mongoosejs.com/docs/middleware.html
I've been wanting to try mongo + SOLR + node but haven't started any coding yet.

Resources