Skip to content

This is a GraphQL API for a programmer/developer social network that allows users to view, filter, sort, add, edit, and delete developers based on their programming skills.

License

Notifications You must be signed in to change notification settings

BaseMax/ProgrammerSocialNetworkGraphQL

Repository files navigation

Programmer Social Network GraphQL API

This is a GraphQL API for a programmer/developer social network that allows users to view, filter, sort, add, edit, and delete developers based on their programming skills.

Getting started

To use this API, you'll need to have Node.js and npm installed on your computer.

  • Clone this repository to your computer.
  • Run npm install to install the required dependencies.
  • Set up a MongoDB database and configure the connection in src/config/index.js.
  • Run npm start to start the GraphQL server.
  • Open a web browser and go to http://localhost:4000/graphql to use the GraphQL interface.

Technologies Used

This API was built with:

  • Node.js
  • NestJS
  • TypeScript
  • GraphQL
  • MongoDB

Usage

Queries

Get list of developers

query {
  developers {
    id
    firstName
    lastName
    email
    skills {
      language
      framework
    }
  }
}

Filter developers by skill

query {
  developers(filter: { skills: { language: "C#" } }) {
    id
    firstName
    lastName
    email
    skills {
      language
      framework
    }
  }
}

Sort developers by name

query {
  developers(sortBy: "lastName") {
    id
    firstName
    lastName
    email
    skills {
      language
      framework
    }
  }
}

Mutations

Add a new developer

mutation {
  addDeveloper(input: { firstName: "John", lastName: "Doe", email: "johndoe@example.com", password: "password123", skills: [{ language: "C#", framework: "ASP.NET" }] }) {
    id
    firstName
    lastName
    email
    skills {
      language
      framework
    }
  }
}

Edit a developer

mutation {
  editDeveloper(id: "<developer id>", input: { firstName: "John", lastName: "Doe", email: "johndoe@example.com", skills: [{ language: "C#", framework: "ASP.NET" }, { language: "React", framework: null }] }) {
    id
    firstName
    lastName
    email
    skills {
      language
      framework
    }
  }
}

Delete a developer

mutation {
  deleteDeveloper(id: "<developer id>") {
    id
  }
}

Register a new user

mutation {
  register(input: { firstName: "John", lastName: "Doe", email: "johndoe@example.com", password: "password123" }) {
    token
  }
}

Login

mutation {
  login(input: { email: "johndoe@example.com", password: "password123" }) {
    token
  }
}

Authors

  • Amirhossein Malekian
  • Max Base

Copyright 2023, Max Base

About

This is a GraphQL API for a programmer/developer social network that allows users to view, filter, sort, add, edit, and delete developers based on their programming skills.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •