Skip to content

DominikMarciniszyn/graphql-typescript-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL TypeORM Demo

Application contains graphql server and is integrated with TypeORM. Server is set up to run on port 8050.

Requirements

  • TypeScript (min version 3.x.x)
  • NodeJS (min version 12.16.x)
  • NPM (min version 6.x.x)

How to run

To run the application, first you need to install the packages:

npm install

Then you can run using command:

npm start

Example GraphQL queries and mutations

  • Get all users
query {
  users {
    id
  	firstname
    lastname
    nickname
    email
    password
  }
}
  • Get user by id
query {
  user(id: "2") {
    id
    firstname
    lastname
    nickname
    email
    password
  }
}
  • Create user
mutation {
  createUser(
    data: {
      firstname: "Jacek",
      lastname: "Papuga",
      nickname: "Kapitan Dżak",
      email: "[email protected]",
      password: "typowehasłodżaka"
    }
  ) {
    id
    firstname
    lastname
    nickname
    email
    password
  }
}
  • Update user
mutation {
  updateUser(
    id: "2", 
    data: {
    	nickname: "Lunatyk"
  	}
  )
  {
    id
    firstname
    lastname
    nickname
    email
    password
  }
}
  • Delete user
mutation {
  deleteUser(id: "3")
}

About

Demo application, simple CRUD uses graphql and typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published