/Nodejs-CRUD-Operation-using-CLA

Nodejs CRUD Operation using CLA is a Nodejs application which accepts and receives data and handler from CLI, process it and store into json file.

Primary LanguageJavaScript

Nodejs CRUD Using Command Line Args

Hi! The goal of the repository is to provide the nodejs crud operations by using command line arguments and storing data into the json file by using file systems.

dependencies

"chalk": "^3.0.0", "yargs": "^15.1.0"

chalk

Chalk comes with an easy to use composable API where you just chain and nest the styles you want. For documentation follow documentation.

yargs

Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. For documentation follow documentation.

CRUD

You can perform the crud operations through command line args. 1. create note

node app.js add --title="Note Create" --body="Note body created"

In the above command ** app.js** is the entry file, add is the event, --title is the title of the note, --body is the body of the note.

Create Note

2. read note

node app.js read --title="Note Create"

In the above command ** app.js** is the entry file, **read ** is the event, --title is the title of the note considering as unique.

Read Note

3. update note

node app.js update --title="Note Create" --updatedTitle="Note Title Updated" --updatedBody="Note Body Updated"

In the above command ** app.js** is the entry file, **update ** is the event, --title is the title of the note considering as unique and updatedTitle and updatedBody are two optional parameters to be updated to the field of the note title and body respectively.

Update Note

4. delete note

node app.js remove --title="Note Title Updated"

In the above command ** app.js** is the entry file, **remove ** is the event, --title is the title of the note considering as unique. It will remove the note item where title will be matched.

Remove Note

5. list of notes

node app.js list

In the above command ** app.js** is the entry file, list is the event. It will retrieve all the notes present in the file.

Remove Note

Happy Coding