Hello, fellow Devs!
We have just launched our new open-source product on Product Hunt.
This time it's a GraphQL Centaur CLI which basically allows to bootstrap backend applications build with GraphQL and generate basic functions like CRUD.
GraphQL Centaur is a CLI tool with a goal to provide seamless experience
creating GraphQL as a service. How does it work?✅ takes any given GraphQL schema as input
✅ generates Mongo/Stucco-js database resolvers in TypeScript
✅ allows you to customize them the way that suits your project
All that to make the process of creating your GraphQL based backend more enjoyable!
I would like to ask you to share your thoughts about it & would appreciate any form of support like feedback or up-votes. We know that there is still a lot of space for the improvements for GraphQL Centaur! Thank you!
Resolver generation
First time when you generate a resolver centaur will also generate needed libraries for collections, DB, Utils and graphql-zeus definitions, then given the following schema:
type Person{
firstName: String!
}
type Query{
people: [Person]!
}
schema{
query: Query
}
after choosing the following elements:
Query
people
CRUD
listFilter
GraphQL Centaur should generate TypeScript resolver placed in $src/Query/people.ts
directory:
import { FieldResolveInput, FieldResolveOutput } from "stucco-js";
import { PersonCollection } from "../db/collections";
import { DB } from "../db/mongo";
import { Utils } from "../Utils";
import { Person, ResolverType, ValueTypes } from "../graphql-zeus";
export const handler = async (): Promise<FieldResolveOutput> => {
const db = await DB();
const col = await db.collection(PersonCollection);
return Utils.CursorToGraphQLArray<Person>(
await col.find({}),
);
};
Top comments (0)