Step 1: Clone/download the project from github repository: https://github.com/mmilardic/nodejs-rimac-intern-task
npm install
npm start
**🚀 GraphQL is now running on http://localhost:3000/graphql **
Step 5: Access the playground at http://localhost:3000/graphql
In case where the port is unavailable, find an available one, and set the value at server.ts line 16.
1. Search user - be aware that some users don't have an email available over the API. In that case, an appropriate message will be returned. githubUsername presents a placeholder.
query {
user(username: "githubUsername"){
username
email
searchedForCounter
followers
following
}
}
query {
mostSearched(limit: 10) {
username
email
searchedForCounter
followers
following
}
}
mutation {
mostPopular
}
- Model: contains the User class which is used as a return value where needed
- Resolver: resolver.ts contains functions that do the work. resolverMap.ts maps functionalities to graphQL endpoints, and is used for creating graphql executable schema.
- Schema: contains the .graphql schema
- schema.ts creates the graphql executable schema
- server.ts creates needed instances and runs the project
- Working functionalities
- Decoupled and cohesive architecture
- Using Typescript and best available library/dependency options
- Email has to be accessed at https://api.github.com/users/{username}/events/public since the basic https://api.github.com/users/{username} endpoint does not contain a value for email.
- When user is not found for the given username, null will be displayed for each field.
- When mostSearched is called and returns empty array, it means that no user has been searched/found previously.
- mostPopular mutation always returns true
- For any other questions - please contact me at [email protected]