https://github.com/yevheniidatsenko/goit-node-cli
⚙️ Home Task | Fullstack. Backend development: NodeJS | Creating Console Applications
https://github.com/yevheniidatsenko/goit-node-cli
ccl goit-node-cli nodejs
Last synced: 3 months ago
JSON representation
⚙️ Home Task | Fullstack. Backend development: NodeJS | Creating Console Applications
- Host: GitHub
- URL: https://github.com/yevheniidatsenko/goit-node-cli
- Owner: yevheniidatsenko
- Created: 2025-03-23T14:09:17.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-23T15:03:41.000Z (3 months ago)
- Last Synced: 2025-03-23T16:20:15.961Z (3 months ago)
- Topics: ccl, goit-node-cli, nodejs
- Language: JavaScript
- Homepage:
- Size: 477 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Home Assignment: Creating Console Applications
## Description
This project is a Node.js console application for managing a contact list. The task involved setting up a repository, implementing functionality to read, add, delete, and retrieve contacts, and executing commands via the terminal.
## Implementation Steps
1. **Project Setup:**
- Created a repository `goit-node-cli`.
- Initialized the project with `npm init`.
- Installed `commander` as a dependency.2. **Core Functionality:**
- Implemented `contacts.js` with file system operations using `fs/promises` and `path`.
- Functions:
- `listContacts()`: Retrieves all contacts.
- `getContactById(id)`: Finds a contact by ID.
- `addContact(name, email, phone)`: Adds a new contact.
- `removeContact(id)`: Deletes a contact.
3. **Command Line Execution:**
- Commands used:
```sh
node index.js -a list
node index.js -a get -i
node index.js -a add -n John -e [email protected] -p 123-456-7890
node index.js -a remove -i
```## Results
- Successfully implemented all required functionalities.
- Below is a screenshot of the console output showcasing the results of executed commands: