Did you try postgraphile? Any thoughts?
Curious to see how you string it all together...
Did you try postgraphile? Any thoughts?
Curious to see how you string it all together...
I based it off the creator of TypeGraphQL GQL-Modules+TypeGraphQL v1 example: https://github.com/MichalLytek/type-graphql/tree/master/exam...
And a LogRocket's blogpost about TypeORM+TypeGraphQL: https://blog.logrocket.com/how-build-graphql-api-typegraphql...
I need to add typeorm/models to my template before sharing, but as an example here's a model which is also a type, using both @ObjectType() & @Field() (type-graphql and @BaseEntity() & @Column() (typeorm)class decorators.
```user.model.ts import { Field, ID, Int, ObjectType, } from 'type-graphql'; import { BaseEntity, Column, Entity, PrimaryGeneratedColumn, } from 'typeorm';
@Entity()
@ObjectType()
export default class User extends BaseEntity {
@Field(() => ID)
@PrimaryGeneratedColumn()
id?: typeof ID;
@Field()
@Column()
name: string;
@Field()
@Column()
email: string;
@Field(type => Int)
@Column()
age: number;
}
```and this is what type-graphql auto-generates for a user schema.
```user.schema.ts
# !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
# !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
type Document { author: User! authorId: ID! }
type Notification { author: User! authorId: ID! }
type Query { users: [User!]! }
type User { age: Int! email: String! id: ID! name: String! } ```
Fwiw, postgraphile is open source and can be plugged into any express app. But I don't think it provides an orm layer or equivalent, so I can see the advantage of this approach too!
Although it's a totally acceptable monetization strategy for any OSS to offer cloud+enterprise support, for my personal projects at least I prefer to choose projects which are more personal/community driven than commercial to put it simply.
But yeah I basically like TypeORM generally also gonna use typeorm-seeding on the mix to stress test the app.