Skip to content

GraphQL API built on .NET 5 using HotChocolate and C#

Notifications You must be signed in to change notification settings

gauravgupta98/socialize-api

Repository files navigation

Azure Deployment Code Analysis

Socialize API

GraphQL API build on .NET 5 using C#, HotChocolate, Entity Framework and SQL Server.

Important - Except login and createUser mutations, all GraphQL requests need Authorization header. To get the authorization token, run login mutation.

Queries

  • Get all users -
query {
    user {
        id
        name
        createdTime
        posts {
            postData
            createdTime
        }
    }
}
  • Get all posts -
query {
    posts {
        id
        postData
        createdTime
        user {
            id
            name
        }
    }
}

Mutations

  • Login -
mutation {
    login (credentials: {
        email: "gg@gmail.com"
        password: "P@ssw0rd"
    })
    {
        token
    }
}
  • Create new user -
mutation {
    createUser (userInput: {
        name: "Test User"
        email: "test@email.com"
        password: "P@ssw0rd"
    })
    {
        user {
            id
            name
            createdTime
        }
    }
}
  • Create new post -
mutation {
    createPost (postData: {
        postData: "Yayyyyy! Hello GraphQL."
        userId: "d10cac6672994ba4eb0b08d8db1413c5"
    })
    {
        post {
            id
            postData
            createdTime
            user {
                name
            }
        }
    }
}

Releases

No releases published

Packages

No packages published

Languages