GithubHelp home page GithubHelp logo

nikulpatel49 / nikulpatel49-apollo-federation-graphql-nodejs-microservices-auth Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 18 KB

API Built with Apollo Federation Microservices + NodeJs + Express + GraphQL + MongoDB + Passport

Shell 0.56% JavaScript 99.44%
apollo-federation expressjs graphql microservices mongodb nodejs passport mongoose

nikulpatel49-apollo-federation-graphql-nodejs-microservices-auth's Introduction

GraphQL Nodejs Authentication and crud operation with Apollo Federation

Simple Demo Application

API Built with Apollo Federation Microservices + NodeJs + Express + GraphQL + MongoDB + Passport.

๐Ÿ“ Features

  • User Register - Login - Reset Password with Email - Change Password
  • List User with Pagination - Delete - Update - Create User with Specific Role
  • List of Roles - Delete - Update - Create

โ–ถ๏ธ Running

  • Clone repo git clone https://github.com/nikulpatel49/apollo-federation-graphql-nodejs-microservice-auth.git
  • Install NPM modules npm install
  • Modify /.env for Api port (optional)
  • Run API npm run server, browse GraphiQL at http://localhost:4000/graphql

Sample GraphQL Queries & Mutation

Query - Get User List

            query {
                users {
                    _id,
                    name,
                    email
                }
            }
            Set http Header
            {
            "Authorization": "Bearer eyJhbGciO9..................."
            }
                

Response

{
  "data": {
    "users": [
        {
            "_id": "6268e2d3b0ab904a787c8b7d",
            "name": "user0",
            "email": "[email protected]"
        },
        {
            "_id": "626e36045caeed669061b1ec",
            "name": "Nikul Patel",
            "email": "[email protected]"
        },
    ]
  }
}
                

Query - Get User by Param

query {
    user(_id: "626e36045caeed669061b1ec"){
        _id,
        name,
        email
    }
}
Set http Header
{
  "Authorization": "Bearer eyJhbGciO9..................."
}
                

Response

{
  "data": {
        "user": {
        "_id": "626e36045caeed669061b1ec",
        "name": "Nikul Patel",
        "email": "[email protected]"
        }
    }
}
                

Mutation - Register

mutation {
    register(
        register: { 
            name: "Nikul Patel", 
            email: "[email protected]",
            password: "user"
        }
    ) {
    status
    message
  }
}
                

Response

{
    "data": {
        "register": {
            "status": true,
            "message": "User has been successfully created",
        }
    }
}
                

Mutation - Login

mutation {
    login(email: "[email protected]", password: "user") {
        status
        message
        token
    }
}
                

Response

{
    "data": {
        "login": {
            "status": true,
            "message": "successfully logged user",
            "token": "Bearer eyJhbGciO9..................."
        }
    }
}
                

Mutation - Delete User

mutation {
  deleteUser(_id: "626e36045caeed669061b1ec"){
    status,
    message,
  }
}
Set http Header
{
  "Authorization": "Bearer eyJhbGciO9..................."
}
                

Response

{
  "data": {
    "deleteUser": {
      "status": true,
      "message": "User has been successfully deleted"
    }
  }
}
                

nikulpatel49-apollo-federation-graphql-nodejs-microservices-auth's People

Contributors

nikul49 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.