Skip to content

BaseMax/typescript-graphql-crud-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typescript GraphQL CRUD Example

A example repository to show how you can create your first GraphQL Restful with TS and not JS.

Getting start

yarn install
yarn start

And open http://localhost:4000/graphql

Create another new project

npx create-graphql-express my-api
cd my-api
npm install
npm run dev

Read more: https://github.com/rafaelnsantos/create-graphql-api

Examples

Insert/Create

mutation { 
 createMovie(
  options: {
    title: "bob3", minutes: 10
  }) {
    id
    title
    minutes
  }
}

Update

mutation {
  updateMovie(id: 30
  input: {
    title: "New bob"
  })
}

Select

{
  movies {
    id
    title
    minutes
  }
}

Delete

mutation {
  deleteMovie(id: 3)
}

References

https://www.youtube.com/watch?v=WhzIjYQmWvs

I fixed some minor changes to works with the latest version of graphql-api.

© Copyright 2021, Max Base

About

A example repository to show how you can create your first GraphQL Restful with TS and not JS.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published