GithubHelp home page GithubHelp logo

14-orm-and-modeling's Introduction

CF LAB

ORM and Modeling

Author: Siobhan Niess

Links and Resources

Documentation

Modules

index.js

app.js

categories.js

products.js

model.js

categories-schema.js

products-schema.js

model-finder.js

v1.js

Exported Values and Methods

Setup

.env requirements

  • PORT - Port Number 3000
  • MONGODB_URI - MONGODB_URI=mongodb://localhost:27017/baseball

Running the app

  • the installastions that you will have to are going to be htppie, nodemon, mongo db
    • these are going to allow you to run the app
  • in your terminal you are going to want to run the command nodemon index.js
  • open up another terminal window/tab and run the command http :3000/api/v1
  • to start up mongo db:
    • start mongodb path <file path to database>
    • start mongodb (this will be in another window/tab of your terminal)
    • start dbs
    • run: db.products.find().pretty(); (this will be to print all itmes in db)
  • GET: see all with categories or products or request an id
    • enter http GET :3000/api/v1/categories or http GET :8080/api/v1/categories/<id>
  • POST: add an item to categories or products
    • category, enter echo '{"name":"Category Name","description":"Category Description"}' |http POST :3000/api/v1/categories
    • product, enter echo '{"name":"Product Name","description":"Product Description"}' |http POST :3000/api/v1/products
  • PUT: update a record in products (/api/v1/products) or categories (/api/v1/categories).
    • update a product, enter echo '{"name":"Product Name","description":"Product Description"}' |http PUT :3000/api/v1/products
    • update a category, enter echo '{"name":"Category Name","description":"Category Description"}' |http PUT :3000/api/v1/categories
  • DELETE: delete a record in categories or products
    • delete a record, enter http DELETE :3000/api/v1/products/

Tests

  • How do you run tests? npm test
  • What assertions were made?
  • What assertions need to be / should be made?

14-orm-and-modeling's People

Contributors

johncokos avatar niesssiobhan avatar

Watchers

 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.