Code Monkey home page Code Monkey logo

basic-mongoose's Introduction

Mongoose Models

Description

This assignment has you practicing full CRUD for a validated resource using ExpressJS and Mongoose.

Pick a resource, for example unicorns.

Create a single overall express app that uses a lib folder with a models folder.

For your resource:

  • Create a schema and model:
    • Pick one or two validations that the schema will have.
    • Unit test the model showing the model failing validation and test a successful model.
    • Implement the validation
    • Also include in your schema:
      • Include a complex object property (a property that has subfields, like an address with city, state, zip)
      • An array property (a property that holds zero or more of some values)
  • Create HTTP REST routes:
    • Write E2E API tests for all of the exposed routes
    • Routes are:
      • GET /resources list ([]) of all the resources
      • GET /resources/:id return single resource object with that id (or 404 if doesn't exist)
      • POST /resources add a new resource and return new entity from db with _id
      • DELETE /resource/:id Delete the resource with that id. Return { removed: <result> } where <result> is true if it was deleted, otherwise false.
      • PUT /resource/:id The resources is updated, meaning the old document content is entirely replaced with the new content from the request body.

Rubric:

  • Resource
    • Schema and Model 2pts
    • Model Unit Tests 2pts
  • Use Model and instance methods in routes 1pt each = 5pts
  • Express App Project Structure (lib, lib/models, tests): 1pt

basic-mongoose's People

Contributors

thomson42 avatar martypdx avatar

Watchers

James Cloos avatar  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.