Giter Site home page Giter Site logo

valik3201 / contacts-node-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 313 KB

A command-line interface (CLI) built with Node.js for managing contacts. Add, remove, and retrieve contacts through simple commands.

JavaScript 100.00%
cli cli-application command-line-interface commander node nodejs nodemon uuid uuid-v4

contacts-node-project's Introduction

Contacts Management Node.js Project

This project provides a simple command-line interface (CLI) for managing contacts stored in a JSON file. It allows users to list contacts, add new contacts, retrieve a specific contact by ID, and remove contacts.

Features

  • List all contacts
  • Add a new contact
  • Retrieve a contact by ID
  • Remove a contact by ID

Screenshots

screenshot screenshot screenshot screenshot

Installation

  1. Clone the repository:
git clone https://github.com/valik3201/contacts-node-project.git
  1. Navigate into the project directory:
cd contacts-node-project
  1. Install dependencies:
npm install

Usage

The CLI supports the following actions:

  • List Contacts: View all contacts.
node index.js --action list
  • Add Contact: Add a new contact. Specify name, email, and phone.
node index.js --action add --name "John Doe" --email "[email protected]" --phone "123-456-7890"
  • Get Contact by ID: Retrieve a contact by providing its ID.
node index.js --action get --id "contact_id_here"
  • Remove Contact by ID: Remove a contact by providing its ID.
node index.js --action remove --id "contact_id_here"

Development

During development, you can use nodemon to automatically restart the application when changes are detected:

npm run start:dev

This command will start the application with nodemon, enabling hot reloading for faster development.

File Structure

  • contacts.js: Contains functions for managing contacts (list, get by ID, add, remove).
  • index.js: Entry point for the CLI application.
  • db/contacts.json: JSON file to store contacts.

Dependencies

  • fs/promises: For file system operations with promises.
  • path: For handling file paths.
  • uuid: For generating unique IDs for contacts.
  • commander: For building command-line interfaces.

Dev Dependencies

  • nodemon: For automatic restarting of the application during development.

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

contacts-node-project's People

Contributors

valik3201 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.