This repository contains several node CLI applications.
I created this project to practice and learn more about Node.js and common Node packages as part of the roadmap.sh full stack pathway.
Read utf-8 encoded text from file
node readFile FILE_PATH
# Example:
node readFile /path/to/input.txt # Reads file at /path/to/input.txt
Write utf-8 encoded text to file
node writefile FILE_PATH STRING1 [STRING2] ...
# Example:
node writeFile output.txt Hello World # Outputs Hello World to ./output.txt
Accepts URL and a CSS selector arguments and prints the text content of the element that matches the selector using axios and cheerio.
node cssSelector.js URL SELECTOR1 [SELECTOR2] [SELECTOR3] ...
# Example:
node cssSelector.js https://example.com .title .description
# Returns all elements with className .title and .description returned by http://example.com
Accepts two dates and prints the most starred GitHub projects in that date range using axios and the GitHub search API
node githubMostStarred.js DATE1 DATE2
# Example
node githubMostStarred.js 2023-09-01 2023-10-19
# Output:
# #1
# hyperdx
# Resolve production issues, fast. An open source observability platform unifying session replays, logs, metrics, traces and errors.
# https://github.com/hyperdxio/hyperdx
# Stars: 2621
# ...
Simple CRUD CLI component using PostgreSQL and node-postgres.
node dbCrud.js COMMAND, [id|all|pending|done|"note_text"]
# Example
node dbCRUD.js --new 'get groceries'
# Output:
# Created!
node dbCRUD.js --list all
# Output:
# [
# {
# task_id: 2,
# task_description: 'clean up the house',
# complete: true
# },
# {
# task_id: 4,
# task_description: 'get groceries',
# complete: false
# }
#]
Database Schema:
Column | Type | Description |
---|---|---|
task_id (PK) | SERIAL | Unique task identifier |
task_description | VARCHAR(255) | Description of the task |
complete | BOOLEAN | True if task complete |
PK = Primary Key |
To install this project locally, follow the following commands (npm required):
git clone https://github.com/dominicgaliano/node-cli.git
cd node-cli/
npm i
To use the CRUD CLI, you will need to have a running postgreSQL database. You will also need to create .env file in the project directory with the following parameters defined:
HOST=
PORT=
DATABASE_NAME=
USER_ID=
USER_KEY=
Warning! The CRUD CLI will overwrite any existing table named 'tasks'.
Distributed under the MIT License. See LICENSE.md
for more information.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request