Giter VIP home page Giter VIP logo

noteworx-cli-express-mongodb's Introduction

NoteWorx README

A basic note application that uses a CLI (Command Line Interface) frontend to capture and manage notes, a note management API built in Express, and MongoDB to store notes.

Features

  • Add a note
  • Remove a note
  • Find notes by:
    • id
    • title
    • tag
  • List all notes
  • Tag a note
  • Update note

High Level Design

noteworx-cli-express-mongodb


Developed With

  • Node.js - Javascript runtime
  • yargs - Helps build CLI tools
  • MongoDB - NoSQL database
  • Docker - Used to host MongoDB instance (Not manadatory. See other options below)
  • Express

Related Projects


Prerequisites

The following software is required to be installed on your system:

  • NodeJS

    The following version of Node and Npm are required:

    • Node 8.x
    • Npm 3.x

    Type the following commands in the terminal to verify your node and npm versions

    node -v
    npm -v
  • MongoDB

    MongoDB 3.x is required

    Type the following command to verify that MongoDB is running on your local machine

    mongo -version

    See alternative MongoDB options below

MongoDB Setup

A running instance of MongoDB is required. Alternatively use a hosted MongoDB from MongoDB Atlas or MLab

One of the 3 options below is recommended to get up and running with MongoDB:

  • Install and host locally
  • Install and host in Docker
  • Register for third party MongoDB hosting
    • Register for and use MongoDB Atlas (Database As A Service)
    • Register for and use MLab (Database As A Service)

Install and Host MongoDB Locally

Installing MongoDB is relatively straight forward. There are currently 3 platform (Windows, Linux, OSX) releases available and can be found here

For more specific installation instructions, please see the following links:

Install And Host Using Docker

Run MongoDB Using Named Volume

To run a new MongoDB container, execute the following command from the CLI:

docker run --rm --name mongo-dev -p 127.0.0.1:27017:27017 -v mongo-dev-db:/data/db -d mongo
CLI Command Description
--rm remove container when stopped
--name mongo-dev give container a custom name
-p map host port to container port
-v mongo-dev-db/data/db map the container volume 'data/db' to a custom name 'mongo-dev-db'
-d mongo run mongo container as a daemon in the background
Run MongoDB Using Bind Mount
cd
mkdir -p mongodb/data/db
docker run --rm --name mongo-dev -p 127.0.0.1:27017:27017 -v ~/mongodb/data/db:/data/db -d mongo
CLI Command Description
--rm remove container when stopped
--name mongo-dev give container a custom name
-p map host port to container port
-v ~/mongodb/data/db/data/db map the container volume 'data/db' to a bind mount '~/mongodb/data/db'
-d mongo run mongo container as a daemon in the background

Third Party Hosting

MongoDB Atlas

MongoDB Atlas is basically a database as a service and is hosted in the cloud. That means that you don't need to install or setup anything to start using MongoDB.

You can get started for free by registering here. The free tier entitles you to 512MB storage.

Please review the documentation here

MLab

MLab also provides MongoDB cloud hosting in the form of database as a service. Once again there is no installation or setup required.

To get started, signup for free account here. The free tier entitles you to 500MB storage.

Please review the documentation here

Install

Follow the following steps to get development environment running.

  1. Clone 'noteworx-cli-express-mongodb' repository from GitHub

    git clone https://github.com/drminnaar/noteworx-cli-express-mongodb.git

    or using ssh

    git clone [email protected]:drminnaar/noteworx-cli-express-mongodb.git
  2. Install node modules

    cd noteworx-cli-express-mongodb
    npm install

Run ESlint

  • Lint project using ESLint

    npm run lint
  • Lint project using ESLint, and autofix

    npm run lint:fix

Run Server (API)

  • Run Express server to host API on default port 8000

    npm run serve
  • Run Express server to host API on default port 8000 with file change monitoring

    npm run serve:dev

Run App

  • Run start

    This will run node app --help and show a list of CLI commands that can be used to manage notes

    npm start
  • Get help

    node app --help
    node app add --help
    node app remove --help
    node app find --help
    node app list --help
    node app tag --help
    node app update --help
  • Add a note

    node app add -t "Programming homework for weekend" -c "Read 'The Art of Computer Programming, Volume 1" --tags "programming, homework"
    node app add -t "Programming homework for today" -c "Read 'Computer Science Illuminated" --tags 'homework'
  • Remove a note

    node app remove --id "{NOTE_ID_GOES_HERE}"
  • Find notes

    • Find notes by title

      node app find -t "homework"
    • Find notes by id

      node app find --id "{NOTE_ID_GOES_HERE}"
    • Find notes by tag

      node app find --tag "programming"
  • List all notes

    node app list
  • Tag a note

    node app tag --id "{NOTE_ID_GOES_HERE}" --tag "{TAG_NAME_GOES_HERE}"
  • Update a note

    node app update --id "{NOTE_ID_GOES_HERE}" -t "Programming homework for weekend" -c "Read 'Computer Science Illuminated Pages 200-500" --tags "homework, compsci"

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

noteworx-cli-express-mongodb's People

Contributors

drminnaar 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.