Skip to content

ajaytusavada/node-projects

Repository files navigation

Demo Node.js Project This is a demo project built with Node.js, showcasing the integration of Express, MySQL, and GraphQL for backend development. The project demonstrates various functionalities including performing CRUD operations using MySQL, and implementing GraphQL for flexible and optimized data querying.

Features Express.js: Used for creating RESTful APIs to handle CRUD operations. MySQL: A relational database for storing and managing project data. GraphQL: Provides an alternative to REST APIs for querying data in a flexible and efficient manner. JWT Authentication: Secure authentication using JSON Web Tokens for user verification. Sequelize ORM: A promise-based Node.js ORM for managing MySQL database interactions. File Uploads: Functionality for handling file uploads via API. Technologies Used Node.js: JavaScript runtime for building the backend application. Express.js: Web framework for building APIs.# Demo Node.js Project

This is a demo project built with Node.js, showcasing the integration of Express, MySQL, and GraphQL for backend development. The project demonstrates various functionalities including performing CRUD operations using MySQL, and implementing GraphQL for flexible and optimized data querying.

Features

  • Express.js: Used for creating RESTful APIs to handle CRUD operations.
  • MySQL: A relational database for storing and managing project data.
  • GraphQL: Provides an alternative to REST APIs for querying data in a flexible and efficient manner.
  • JWT Authentication: Secure authentication using JSON Web Tokens for user verification.
  • Sequelize ORM: A promise-based Node.js ORM for managing MySQL database interactions.
  • File Uploads: Functionality for handling file uploads via API.

Technologies Used

  • Node.js: JavaScript runtime for building the backend application.
  • Express.js: Web framework for building APIs.
  • MySQL: Relational database management system.
  • GraphQL: Query language for APIs.
  • Sequelize: ORM for database interactions.
  • JWT: For secure authentication.

Getting Started

Prerequisites

Ensure that you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/your-repository-name.git
  2. Navigate to the project directory:

    cd your-repository-name
  3. Install project dependencies:

    npm install
  4. Configure the MySQL database:

    • Create a new MySQL database.
    • Update the connection details in the .env file (host, username, password, database name).
  5. Start the server:

    npm start

    The server should now be running on http://localhost:3000.

API Endpoints

  • CRUD Operations (Express Routes):

    • GET /api/items: Fetch all items.
    • GET /api/items/:id: Fetch an item by ID.
    • POST /api/items: Create a new item.
    • PUT /api/items/:id: Update an item.
    • DELETE /api/items/:id: Delete an item.
  • GraphQL Endpoint:

    • POST /graphql: Access the GraphQL API for flexible queries.

Authentication

This project uses JWT for user authentication. You can register and log in to get a token, which is required for protected routes.

  • POST /api/auth/register: Register a new user.
  • POST /api/auth/login: Log in and get a JWT token.

File Uploads

You can upload files via the /upload route. The files will be stored on the server.

Contributing

  1. Fork this repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

MySQL: Relational database management system. GraphQL: Query language for APIs. Sequelize: ORM for database interactions. JWT: For secure authentication.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published