# MiniMVC

> A lightweight MVC app that excels at code organization

Latest version **0.0.1** (published 2011-10-09) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install MiniMVC
pnpm add MiniMVC
yarn add MiniMVC
bun add MiniMVC
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2011-10-09 |
| First published | 2011-10-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jakob Heuser |
| Maintainers | jakobo |
| Keywords | mvc, lightweight, organize |

## Links

- npm: https://www.npmjs.com/package/MiniMVC
- Repository: https://github.com/Jakobo/MiniMVC
- Homepage: https://github.com/jakobo/MiniMVC
- npm.io page: https://npm.io/package/MiniMVC

## Dependencies (1)

- [seq](https://npm.io/package/seq.md) 0.3.3

## Recent versions

- 0.0.1 (latest) — 2011-10-09

## README

# ###################### #
# NOTE: ARCHIVED PROJECT #
# ###################### #

This project is archived for historical reasons and should not be used in production.

------------------------------------------------------------------------------------------

MiniMVC: Simple Code Organization
===
As Taken from the File...

The entire purpose of MiniMVC is to get out of the way. If you've selected your
own router, template layer, etc, you may just want an easy way to organize the
code. That's where MiniMVC comes in.
  
What MiniMVC is:

* Code Structure - directories for /controllers, /models, and /views
* Light - scans the file structure once on server start
* Convienent - quick access via MiniMVC.controller("Name", params)
  
What MiniMVC is not:

* A router (there's plenty of those around)
* Middleware (probably because I haven't learned Connect well enough yet)
  
How do I use it?
---
```
require("MiniMVC").boot(__dirname, function () {
  // directories scanned and loaded
  server = require("http").createServer(function(request, response, function) {
    // make some decisions about where to route
    // params is an object with additional key/values you create or take from a router
    require("MiniMVC").begin(request, response, params).controller("Root").index()
  });
});
```

* *boot(directory, callback)*: Start the engine. Scans your controllers, models, and views
  directories, and once everything is ready, invokes callback()
* *begin(request, response, params)*: Begins the MVC processing. request, response, and
  params are passed through and available in your models, controllers, and views via
  this.request(), this.response(), and this.params()
* *.controller(name)* this is a chained function. The "Root" controller is loaded, and
  returned. In this case, we're calling the index() method on it.

```
// and in controllers/rootcontroller.js
// if you aren't using coffeescript, you need to extend Controller, and call
// the super class' constructor()
Controller = require("MiniMVC").Controller
class RootController extends Controller
  index: () ->
    // the following methods are available
    // @request(): get the request
    // @response(): get the response (null for models)
    // @params(): get the params
    
    // @model(name): invoke a model
    // @view(name): invoke a view

// the export object defines what will be found under .controller(name)
// in this case, we're exposing "Root" as a callable item
exports.Root = RootController
```

That's it in a nut shell.

---
_Source: https://npm.io/package/MiniMVC · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
