Giter VIP home page Giter VIP logo

plexi's Introduction

plexi

Join the chat at https://gitter.im/attrs/plexi

NPM Version NPM Downloads Build Status Gratipay

Plexi is a plugin system for nodejs. Helps to make a horizontal plugin architecture.

Getting Started

Installation
$ sudo npm install plexi -g
Initialize project
# init with default activator js file (activator.js file will be created)
$ plexi init

# or your own activator js file can be specified
$ plexi init src/youractivator.js
Install plugins
# if you want install according to package.json/plexi.dependencies
$ plexi install

# install plexi based packages you want (--save option for save package.json/plexi.dependencies)
$ plexi install plexi.workbench --save
$ plexi install plexi.mongodb@^2.6.5 --save

# also can install from git repository
$ plexi install https://github.com/attrs/plexi.mongodb --save
$ plexi install attrs/plexi.mongodb --save

# uninstall
$ plexi uninstall plexi.workbench --save

# also can install from file system for local test (by symbolic link)
# (useful method for developing several plugins)
$ plexi link file:package_dir_path --save

# unlink
$ plexi unlink file:package_dir_path --save
Writing activator

See https://github.com/attrs/plexi/tree/master/examples

module.exports = {
	start: function(ctx) {		
		// preference from plexi.json
		var options = ctx.preference;
		
		// simple example for use plexi.http
		var http = ctx.require('plexi.http');
		var bucket = http.create().mount('/myapp');
		bucket.get('/index.html', function(req, res) {
			res.write('Hello, World!\n' + JSON.stringify(options));
		});
		
		console.log('[' + ctx.id + '] start');
	},
	stop: function(ctx) {
		console.log('[' + ctx.id + '] stop');
	}
};
Start plugin-system
# will be executed activator.js specified from plexi init (pakage.json/plexi.activator)
$ plexi start
...
plexi$ _
Internal cli usage
# plugin system status
plexi$ p
...
 
# plugins status
plexi$ ss
0     started      yourpacakage        0.0.1
1     started      plexi.http          0.1.0 
...

# plugin info ("0" is ss index number)
plexi$ p 0

# stop plugin
plexi$ stop 0

# start plugin
plexi$ start 0

# help
plexi$ h

# quit
plexi$ q

License

MIT

plexi's People

Contributors

joje6 avatar gitter-badger avatar

Stargazers

Manol Kalinov avatar  avatar

Watchers

James Cloos avatar  avatar jinkyung avatar Moon Han Yong avatar  avatar kwonhyunwoo 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.