The following repo is a proof of concept built to explore in depth GraphQL. It's built on top of graphql.js and express-graphql. Its presentation can be found at: https://drive.google.com/open?id=1u3k0rPZwdEmFZvMMchBfL854Vic8aIXIkv4TY6W4oKU
- Authentication and Authorization.
- Usage as Data Access Layer.
- Custom Logging in the pipeline.
- Clone the repo.
- install the dependencies
npm install
- Start the application
npm run dev
- Browse the url: http://localhost:3000/graphql
Get 10 users.
query getUsers {
users(take: 10) {
firstname
}
}
Create a user.
mutation create($userData: userInput) {
createUser(user: $userData){
firstname
}
}
{
"userData": {
"username": "testing_username",
"firstname": "testing_firstname",
"lastname": "testing_lastname",
"emailId": "eeaassd@gmail.com",
"gender": "M",
"age": 12
}
}
Usage of fragments
query someQuery($gender: String = "M") {
kingUser: users(take: 5,gender: $gender) {
...someFragments
}
}
query secondQuery{
someUser: users(take:5,firstname: "Shadab",gender: "M") {
...someFragments
}
}
fragment someFragments on User {
firstname,
gender,
age,
userId,
emailId
}
Prisma is a library that aims to replace traditional orm tools with the usage of graphQL. Currently they main feature are:
- Cross database operations
- High-performance data layer
- Out-of-the-box CRUD operations
- GraphQL subscriptions.
*. GraphQL: https://graphql.github.io/
*. Online GraphQL Playground: https://github.com/graphql/graphiql
*. Prisma: https://www.prisma.io/
*. GraphQL at Faccebook: https://www.youtube.com/watch?v=etax3aEe2dA
*. Tutorial on FullStack GraphQL: https://www.howtographql.com/