Giter Club home page Giter Club logo

mvc-design-pattern's Introduction

mvc-design-pattern

This is a simple demo of the Model View Controller (MVC) design pattern in vanilla javascript without using existing library or framework. THIS IS A DEMO AND IT IS FOR LEARNING PURPOSE ONLY and not meant for live app.

repo url

mvc-design-patter

File Structure

Project folder: mvc-design-pattern

  • controllers
    • bookController.js book logic handler
  • models
    • book.js the book model
    • model.js an abstract base model inheritable by other models. example Book...
  • views
    • book
      • create.js
      • edit.js
      • index.js
      • detail.js
      • lend.js
  • databases
    • books.js

Base controller, and view was intentionally not created. It will perhaps be created in the future. However, model.js is the base model for all entities like: User, Book ... on this project.

Usage

  1. Requirements: node.js installed. All scripts in this project are JS. It does not require setting up a server.

  2. Clone or run online

  3. To fetch or list all books, use the command: node views/book/index.js

  4. To fetch a single book, use the command: node views/book/detail.js You can open the file to see the change the search query according to specs.

  5. To update or edit a book: node views/book/edit.js. You can also check the edit view to make changes.

  6. To create a book: node views/book/create.js.

  7. To lend a book: node views/book/lend.js.

Contributing

It will be great if you decide to contribute to this small app and make it better. For now there is no guide line except that the coding style need to follow: Airbnb Style guide and ESlint standard. Just make a pull request.

Disclaimer

Note that the data at databases/books.js are dummy data and not (or may not be) accurate inline with what exists out there.

Author

Ezeh Livinus

mvc-design-pattern's People

Contributors

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