0.1.0 • Published 10 months ago

viper v0.1.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
10 months ago

#Viper

Build Status

##Install

npm install --save viper

Docs

Basic usage

var viper = require('viper');

var app = viper();

app.plugin(function() {
	
	// Define services
	this.service('helloWorld', function() {
		return function helloWorld(name) {
			return 'Hello '+(name || 'World');
		};
	});
	
	// Define providers
	this.provider('myDataCon', function(){
		
		var db = // create database-connection
		
					
		// return a service-function wich will be 
		// injected when requested as a service. 
		return function(){
			return db;
		};
		
	});
	
	// Use config methods for middleware 
	// like session/cookie/etc - handling
	this.config(function(app){
		app.use(...);
	});
	
	// Use run methods for route definitions
	this.run(function(router, helloWorld){
		router.get('/helloWorld', function(req, res){
			res.send( helloWorld('Peter') );
		})
	});
			
});

// use plugins from external files or npm modules
app.plugin( require('path/to/plugin/or/npm-module-name') );


// bootstrap your viper-application
// should be the last call in your file.
// Plugins which will be registred after this, won't be available.
app.bootstrap();
0.1.0

10 months ago

0.0.0

11 months ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago