Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dimvc

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dimvc

Experimental mvc framework built on top of express using argument name dependency injection (dependable).

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dimvc

Experimental mvc framework built on top of express using argument name dependency injection (dependable).

Usage

Dependencies are auto created based on the name of the files in several directories.

The structure is as follows:

+ api
+---+ controllers
    + models
    + services
    + routes.js
+ config
+ public
+ views

Dependencies are created from files in the structure. There are also some default dependencies:

  • log (winston)
  • mongoose (instance of mongooseQ)

For example a logging service that would be required in as loggingService and located in api/services/logginsService, would be written:

'use strict';
module.export = function(log) {
    // winston is available as log, because I named my argument, "log"
    return function(something) {
        log.info('oh wow, ' + something);
    }
}

Testing

dimvc was built with testing in mind. Dependency injection makes testing easy.

Use dimvc.test() to run tests. The test method returns a dependable container with all the dependencies hooked up. This means mocks can be easilly injected at test time.

For example to test userController that depends on UserModel (this example is in the hello world )

dimvc
    .test(root)
    // .test returns a dependable container, so we can mock out dependencies at resolve time:
    .resolve({
        UserModel : MockUserModel
    }, function(userController) {
        userController.showUser()(req, function() {}, function() {});
        findOneStub.should.have.been.calledWith({
            _id: '007'
        });
        done();
    });

See the hello world for an example.

  • 2014-10-17 0.0.1 Readme fix
  • 2014-10-17 0.0.0 Unit and integration test support
  • 2014-10-15 0.0.0-beta.3 Adding github info to pkg.json
  • 2014-10-15 0.0.0-beta.2 Work around models and added body parse
  • 2014-10-14 0.0.0-beta.1 Initial release

FAQs

Package last updated on 17 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc