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

microscope-web

v0.4.2

Published

ES6, Express/Connect fully compatible, POO & Modular Web framework

Downloads

35

Readme

microscope-web

ES6, Express/Connect fully compatible, POO & Modular Web framework.

microscopejs

NPM Build Status

Requirements

  • node
  • npm
  • gulp

Node.js installation

Install on OSX

Using homebrew:

brew install node

Install on Linux (Ubuntu/Mint)

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Install on Windows

Download Node.js MSI

Installation

install gulp (sudo on linux/OSX) :

npm install gulp -g

install dependencies (sudo on linux/OSX) :

npm install

Development commands

test (run gulp test):

npm test

test:

gulp test
  • validate source code (jsHint).

docs:

gulp docs
  • generate annoted code documentation (docco).
  • generate annoted code samples documentation (docco).

How to use ?

Check out project samples !!!

Application class

With ES5


var HttpApplication = require('microscope-web').HttpApplication;
var HomeController = require('./controllers/HomeController');
var AuthApplication = require('../auth/AuthApplication');
var logger = require('./middlewares/commonMiddleware');

var Application = HttpApplication.extend({
	
	// register application controllers in array
	controllers: [HomeController],
	
	// register application middlewares in array
	// templateEngine, logging, authentication, ...
	// call middleware with express instance in parameter.
	// configure using app.use([middleware]);
	middlewares: [logger],
	
	// use AuthApplication class as sub application 
	// map to /auth/{controller}/{action}
	areas: {
		'/auth': AuthApplication
	}
});

module.exports = Application;

With ES6


import {HttpApplication} from 'microscope-web';
import HomeController from './controllers/HomeController';
import AuthApplication from '../auth/AuthApplication';
import {logger} from './middlewares/commonMiddleware';

class Application extends HttpApplication {

	// register application controllers in array
	get controllers(){
		return [HomeController];
	}

	// register application middlewares in array
	// templateEngine, logging, authentication, ...
	// call middleware with express instance in parameter.
	// configure using app.use([middleware]);
	get middlewares(){
		return [logger];
	}

	// use AuthApplication class as sub application 
	// map to /auth/{controller}/{action}
	get areas(){
		return {'/auth': AuthApplication}
	}
}

var a = new Application();
a.run(() => console.log('application running'));

With experimental ES7

import {HttpApplication, decorators} from 'microscope-web';
import AuthApplication from '../auth/AuthApplication';
import HomeController from './controllers/HomeController';
import {logger} from './middlewares/commonMiddleware';

var {controllers, middlewares, areas} = decorators;

@controllers([HomeController])
@middlewares([logger])
@areas({'/auth': AuthApplication})
class Application extends HttpApplication {
	
}

var a = new Application();
a.run(() => console.log('application running'));

Controller class

With ES5:


var Controller = require('microscope-web').Controller;
var filters = require('../filters/commonFilters');

var HomeController = Controller.extend({
	
	filters: [filters.controllerFilter],
	
	routes: {
		'get /': [filters.actionFilter, 'index'],
		'get /home/about': 'about'
	},

	// index action
	// GET /
	index: function(request, response){
		response.send('index HomeController');
	},

	// about action
	// GET /home/about
	about: function(request, response){
		response.send('about HomeController');
	}
});

module.exports = HomeController;

With ES6:


import {Controller} from 'microscope-web';
import {controllerFilter, actionFilter} from '../filters/commonFilters';

class HomeController extends Controller {

	// add some controllers filter
	get filters(){
		return [controllerFilter];
	}

	// configure controller routing with callback array
	get routes(){
		return {
			'get /': [actionFilter, 'index'],
			'get /home/about': 'about'
		}
	}

	// index action
	// GET /
	index(request, response){
		response.send('index HomeController');
	}

	// about action
	// GET /home/about
	about(request, response){
		response.send('about HomeController');
	}
}

export default HomeController;

With experimental ES7


import {Controller, decorators} from 'microscope-web';
import {controllerFilter, actionFilter} from '../filters/commonFilters';
var {filters, routes} = decorators;

@filters([controllerFilter])
@routes({
	'get /': [actionFilter, 'index'],
	'get /home/about': 'about'
})
class HomeController extends Controller {

	// index action
	// GET /
	index(request, response){
		response.send('index HomeController');
	}

	// about action
	// GET /home/about
	about(request, response){
		response.send('about HomeController');
	}
}

export default HomeController;

Roadmap

  • TypeScript definition support