Giter VIP home page Giter VIP logo

al-lab-command-line-crud-application's Introduction

Command Line CRUD Application

You will build an application that lets users round up the change for each purchase and set it as a donation.

Getting Started

  1. Fork and clone this repository
  2. Open up the repository in your code editor.
  3. Start a new node project
  4. Set up a .gitignore file
  5. Install nanoid version 3
  6. Install chalk version 4

Instructions

Build out the following functionality. Be sure to organize your code so that the functions stay small and have one job, and also, manage your files so that it is clear what kind of functions are within each file.

  • A user can create a purchase. The purchased object will have the following:
    • id - generated by nanoid
    • name - the name of the purchase
    • amount - the purchase amount
    • donation - the donation amount, rounded to two decimal places
  • A user can see an index of all their purchases, showing the id and the name.
  • A user can see a show view with all the purchase details. This view should have additional styling (see below).
  • A user can update a purchase.
  • A user can delete a purchase.
  • A user can see the total amount of money for donation.

Here is an example of additional styling for the show view

Additional styling for the show view

Include Jest, and write a minimum of two tests. You could:

  • Confirm all the correct fields exist when creating a new item.
  • Make sure the correct datatype is being inserted into each field.

With the following functionality, you would likely want to make a sample data set that is always the same (you can create a small array of objects (~2-3 items) that is hard-coded in your test file, or you can create a separate file and import it). You would not use the fs module to update any changes permanently. You can look for examples of using sample data with a previous lab you have completed.

  • Confirm that the function to create one item creates only one item and appends it to the test array.
  • Confirm that the delete function deletes the correct object in the test array.
  • Confirm that the edit function edits the correct object in the test array.
  • Confirm that the output for the show view matches your expected output.
  • Confirm that the output for the index view matches your expected output.

Bonus

Instead of your user remembering the order to enter data. Upgrade your functionality so your user can create key-value pairs and then the user can input them in any order:

npm run update amount="4.44" name="Mechanical Pencil" id=rSl_

al-lab-command-line-crud-application's People

Contributors

anickacodes avatar krafalski 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.