This example shows how to implement a CRUD GraphQL API with TypeScript based on Prisma Client, TypeGraphQL and the typegraphql-prisma
integration. It is based on a SQLite database - you can find the database file with some dummy data at ./prisma/dev.db
.
Clone this repository:
git clone [email protected]:nikolasburk/typegraphql-prisma-crud.git --depth=1
Install npm dependencies:
cd typegraphql-prisma-crud
npm install
Launch your GraphQL server with this command:
npm run dev
Navigate to http://localhost:4000 in your browser to explore the CRUD API of your GraphQL server in a GraphQL Playground.
{
posts {
id
title
author {
email
name
id
}
}
}
mutation {
createPost(data: {
title: "Hello World"
author: {
create: {
name: "James"
email: "[email protected]"
}
}
}) {
id
author {
id
}
}
}