Skip to content

EmmanuelStan12/TimartAssessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimartAssessment on GraphQL, Sequelize and NodeJS

This GraphQL endpoint provides functionality for managing users data and their orders.

View Documentation

You can view the full documentation for this application here.

The documentation provides detailed information about the API endpoints, usage instructions, and other essential resources.

Usage

You can send GraphQL requests to the designated endpoint in the documentation with appropriate query and mutation operations along with necessary variables.

Getting Started

Prerequisites

  • Make sure you have NodeJS installed on your system. The version used on this project was v18.18.2.
  • Although npm comes with NodeJS, do make sure you have npm installed also. The version used on this project was v9.8.1.
  • Ensure that you have an active instance of mysql running.
  • Create a file .env in the root directory, if it doesn't exist and insert the following information:
- DB_USERNAME=your_username
- DB_PASSWORD=your_password
- DB_DATABASE=your_database
- DB_HOST=your_sql_host
- DB_DIALECT=mysql
- PORT=4000

Use the package manager npm to install the necessary dependencies.

npm install

Running the application

  • You can run the application by typing one of the following commands on your preferred terminal.
npm start
npm run start
node ./src/app.js
  • Open any GraphQL playground of your choice and go to the Url specified in the console as to where the server is running, e.g http://localhost:4000/graphql
  • Once the server starts running, 1000 records are added to the User Table and 5000 records of Orders to the Order Table, but this wouldn't be done in subsequent server initializations.
  • Explore the capabilities of the endpoint.
  • A major concern for me is the task to grab the top ten users with the most orders placed, though it wasn't specified to create an endpoint for that, the function for getting it along with the query is in the UserService.js file in the directory src/services with a function named getTopTenUsersByMostOrders.
  • If you're having any issues in running the application, Please reach out to me here.
  • You can also view the hosted version here.

Contributors

  • Amadiegwu Ndunuju Emmanuel

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published