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.
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.
This API was built with:
- Node.js
- NestJS
- TypeScript
- GraphQL
- MongoDB
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
}
}
}
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
}
}
- Amirhossein Malekian
- Max Base
Copyright 2023, Max Base