npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexagonjs

v0.10.3

Published

Simplistic high-configurable Node-JS application framework

Downloads

11

Readme

HexagonJS

Project status

Simplistic high-configurable Node-JS application framework with dependency injection.

Installation   NPM version

With node installed:

# Get the latest stabe hexagonjs
$ sudo npm install hexagonjs -g

Creating first project

# create simple web app
$ hexagonjs -e <project_name>

# install all dependencies
$ cd <project_name>
$ npm install

# run your app
$ node app

Overview

HexagonJS can be used to build any application, not only web. I used it to build my webpage and non-http AI for some programing contest.

HexagonJS has build-in dependency injection system. All modules from modules directories can be loaded by typing its filename (without extenion) as arguments for function.

app/controllers/home.js

module.exports = function(http){
	http.get('/', function(req,res){
		res.render('index');
	});
}

In this example module from modules/http.js is loaded to be used in controller.

Modules

Whole framework bases on modules. Each module have its dependencies. Modules will be loaded in order - dependencies first. All dependencies will be accessible from the controller function. Controller function is something like constructor of the module - what it will return it will be accesible as the module.

Currently there are 2 ways to create modules. First is the shorter one: app/modules/randomUser.js

module.exports = function(users){
	return function(){
		return users.get(Math.round(Math.random()*users.count()));
	}
}

This is very simple example but should be enouch to present basics. module.exports is a function which will have injected parameters by its names. In this case there will be loaded app/modules/users.js and injected as the users argument to the function. Function returns in this case a function to randomly pick user from users module, that means when other module will use randomUser as a dependencie - it will be a function that returns a random user.

Second way to define module is by object way, i will use the same example:

app/modules/randomUser.js

module.exports = {
	dependencies: ['users'],
	controller: function(anyname){
		var users = this.argv.users;

		return function(){
			return anyname.get(Math.round(Math.random()*anyname.count()));
		}
	}
}

In this case all dependencies are listed in dependencies property and they will be injected in order to the controller function - this gives us an ability to give any names to the arguments - its handy when names are very long. If there are too many dependencies to list them as function arguments you can access to them by this.argv object which contains all arguments.

Configuration

The loader module

TODO...

Generator options

-e or --express - will add simple express framework support

License

MIT License Copyright © 2014 Mateusz Russak