0.10.11 • Published 9 years ago

hardwire v0.10.11

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Hardwire

Work in progress

Structured and scalable node.js app container

(if you are looking for the CMS check JetKit)

Features

  • Scalable architecture structured in blocks and plugins
  • Tree based dependency container
  • Build system
  • Boilerplate generator
  • Environment oriented configurations loader
  • Add .env file content to environment variables
  • Environment variables processor

Instructions

Coming soon

Express - MongoDB example

var Hardwire = require('hardwire'),
	express = require('express'),
	mongoose = require('mongoose');

var hardwire = new Hardwire({
	output: 'output/build',

	// folders to build in every block
	buildFolders: ['public', 'views'],

	// default config
	config: {port: 3000},

	// force load production environment
	environment: 'production',

	// rules for adding environment variables into config
	envProcessing: {
		// this will set MONGO_URI value from environment variables
		// into mongodb.uri property of config
		MONGO_URI: 'mongodb.uri'
	},

	// to do before build blocks
	beforeBuild: function (next) {
		// this.config ....
		next();
	},

	// to do after build blocks
	afterBuild: function (next) {
		next();
	},

	// work  with config before load config
	beforeConfig: function (next) {
		// this.config ....
		next();
	},

	// work with config after load config
	afterConfig: function (next) {
		next();
	},

	// work  with tree before load tree
	beforeLoad: function (next) {
		this.tree
		.add( 'express', express )
		.add( 'app', express( ))
		.add( 'mongoose', mongoose )
		.then( next );
	},

	// rules for load every block
	load: function (blockPath, next) {
		this.tree
		.folder( blockPath + '/lib', {
			hidden: true
		})
		.folder( blockPath + '/models', {
			group : 'models',
			suffix: 'Model'
		})
		.folder( blockPath + '/controllers', {
			group : 'control',
			suffix: 'Ctrl'
		})
		.folder( blockPath + '/routes', {
			group: 'router',
			suffix: 'Router'
		})
		.then( function () {
			next();
		});
	},

	// work with tree after load tree
	afterLoad: function (next) {
		next();
	},

	// to do after resolve tree
	// afterAll catch all middleware errors
	afterAll: function (err) {
		if (err) { throw err;}
		var app = this.tree.get( 'app' ),
			http = require('http');
		http.createServer( app ).listen( this.config.port );
		console.log( 'listening port ' + this.config.port );
	}

});

// resolve framework
hardwire.resolve();


© 2015 Jacobo Tabernero - jacoborus

Released under MIT License

0.10.11

9 years ago

0.10.10

9 years ago

0.10.9

9 years ago

0.10.8

9 years ago

0.10.7

9 years ago

0.10.6

9 years ago

0.10.5

9 years ago

0.10.4

9 years ago

0.10.3

9 years ago

0.10.2

9 years ago

0.10.1

9 years ago

0.10.0

9 years ago

0.9.1

9 years ago

0.9.0

9 years ago

0.8.4

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.8

9 years ago

0.7.7

9 years ago

0.7.6

9 years ago

0.7.5

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.4

9 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.13

9 years ago

0.2.12

9 years ago

0.2.11

9 years ago

0.2.10

9 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.51

9 years ago

0.0.50

9 years ago

0.0.49

10 years ago

0.0.47

10 years ago

0.0.46

10 years ago

0.0.45

10 years ago

0.0.44

10 years ago

0.0.43

10 years ago

0.0.42

10 years ago

0.0.41

10 years ago

0.0.40

10 years ago

0.0.38

10 years ago

0.0.37

10 years ago

0.0.36

10 years ago

0.0.35

10 years ago

0.0.34

10 years ago

0.0.33

10 years ago

0.0.32

10 years ago

0.0.31

10 years ago

0.0.30

10 years ago

0.0.29

10 years ago

0.0.28

10 years ago

0.0.27

10 years ago

0.0.26

10 years ago

0.0.25

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.20

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.19

10 years ago

0.0.2

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.1

10 years ago