Sign inSign up

2424833f/graphql-image

By 2424833f

Updated almost 2 years ago

Image
0

736

2424833f/graphql-image repository overview

Guide to Run GraphQL Docker Application

  1. Make sure Docker is installed on your machine. If not, you can download and install it from here.

  2. Open a terminal or command prompt on your system:

    • Windows: Press Win + R, type cmd or PowerShell, and press Enter.
    • MacOS: Open Terminal from the Applications > Utilities folder.
    • Linux: Open the terminal from your application launcher or use the shortcut Ctrl + Alt + T.
  3. Run the following command to download the Docker image from Docker Hub:

    docker pull 2424833f/graphql-image
    
  4. Once the image is downloaded, you can run the container with the following command:

    docker run -d -p 4000:4000 --name graphql-app 2424833f/graphql-image
    
  5. To verify that the container is running, execute:

    docker ps
    
  6. Once the container is running, access the application in your browser or GraphQL client at:

    http://localhost:4000
    
  7. If you need to access the container logs, use the following command:

    docker logs graphql-app
    
  8. To stop the container, use:

    docker stop graphql-app
    
  9. To remove the stopped container, use:

    docker rm graphql-app
    

GraphQL Queries and Mutations

Queries:
  1. Find a Person by Name:

    query {
      findPerson(name: "Freddy Moreira") {
        name
        phone
        address {
          street
          city
        }
        id
      }
    }
    
  2. Fetch All Persons:

    query {
      allPersons {
        name
        phone
        address {
          street
          city
        }
        id
      }
    }
    
Mutations:
  1. Add a New Person:
    mutation {
      addPerson(
        name: "Juanito Alimaña"
        phone: "09000000123"
        street: "Av. Salcedo"
        city: "Cuenca"
      ) {
        name
        phone
        address {
          street
          city
        }
        id
      }
    }
    

Additional Notes

  • Make sure to install the required packages in your project if you’re working locally:
    npm install apollo-server graphql uuid
    

-You can use a GraphQL client like GraphiQL or Postman to interact with the API.

Connect to the repository:

-For any questions, here is the GraphQL GitHub repository where you can find more details to guide you through the project.

Tag summary

Content type

Image

Digest

sha256:86186c008

Size

68.3 MB

Last updated

almost 2 years ago

docker pull 2424833f/graphql-image