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

express-composer

v1.0.3

Published

A composition library to help organize your express routes and handlers

Downloads

7

Readme

express-composer

A composition library built by extending express

Build Status Coverage Status Dependency Status devDependency Status

Modules

<a name="module_express-composer"></a>

express-composer

method for creating an express application with express-compose mixin

Example

var expressComposer = require('express-composer');

expressComposer() ⇒ app

Creates an extended express app

Kind: Exported function
Example

var express = require('expressComposer'),
    app = express();

expressComposer.extend(app) ⇒ app

Extends an express app if it was not created with express-compose

Kind: static method of expressComposer

| Param | Type | Description | | --- | --- | --- | | app | function | express app |

Example

var express = require('express'),
    expressComposer = require('express-composer'),
    app = express();
expressComposer.extend(app);

expressComposer.handle(handlers, scopeProvider) ⇒ function

Creates an express middle ware handler that will iterate through composers handlers

Kind: static method of expressComposer

| Param | Type | Description | | --- | --- | --- | | handlers | Array.<function()> | function | | | scopeProvider | ScopeProvider | the scope of these handlers |

expressComposer.error(handlers, scopeProvider) ⇒ function

Creates an express middle ware error handler that will iterate through composers error handlers

Kind: static method of expressComposer

| Param | Type | Description | | --- | --- | --- | | handlers | Array.<function()> | function | | | scopeProvider | ScopeProvider | the scope for these handlers |

expressComposer.validate(validate, scopeProvider) ⇒ function

Create an express middle ware that validates an incoming request

Kind: static method of expressComposer

| Param | Type | Description | | --- | --- | --- | | validate | function | validation function | | scopeProvider | ScopeProvider | scope variable |

expressComposer~scopeArg : Object | function | Promise.<Object>

Kind: inner typedef of expressComposer

expressComposer~requestHandlers : function | Array.<function()>

Kind: inner typedef of expressComposer

expressComposer~pathArg : String

Kind: inner typedef of expressComposer

expressComposer~appOptions : Object

Express application options passed into express

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | dotFiles | String | Option for serving dotfiles. Possible values are �allow�, �deny�, and �ignore� | | etag | Boolean | Enable or disable etag generation | | extentions | Boolean | Sets file extension fallbacks. | | index | Object | String | Sends directory index file. Set false to disable directory indexing. | | lastModified | Boolean | Set the Last-Modified header to the last modified date of the file on the OS. Possible values are true or false. | | maxAge | Boolean | Set the max-age property of the Cache-Control header in milliseconds or a string in ms format | | redirect | Number | Redirect to trailing �/� when the pathname is a directory. | | setHeaders | function | Function for setting HTTP headers to serve with the file. |

expressComposer~routerOptions : Object

Options passed into express [Router]{http://expressjs.com/api.html#router}

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | caseSensitive | Boolean | Enable case sensitivity. | | mergeParams | Boolean | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child�s value take precedence. | | strict | Boolean | Enable strict routing. |

expressComposer~requestMethod : object

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | validator | function | function used to validate the request | | preHandlers | requestHandlers | handlers that will be called during execution of the route | | scope | scopeArg | scope values to inject into the context of the handlers | | errorHandlers | requestHandlers | handlers called if there is an error during the request | | name | String | name of the method | | description | String | description about what this method does |

expressComposer~requestMethods : object

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | checkout | requestMethod | requestHandlers | handles checkout requests | | connect | requestMethod | requestHandlers | handles connect requests | | copy | requestMethod | requestHandlers | handles copy requests | | delete | requestMethod | requestHandlers | handles delete requests | | get | requestMethod | requestHandlers | handles get requests | | head | requestMethod | requestHandlers | handles head requests | | lock | requestMethod | requestHandlers | handles lock requests | | m-search | requestMethod | requestHandlers | handles m-search requests | | merge | requestMethod | requestHandlers | handles merge requests | | mkactivity | requestMethod | requestHandlers | handles mkactivity requests | | mkcol | requestMethod | requestHandlers | handles mkcol requests | | move | requestMethod | requestHandlers | handles move requests | | notify | requestMethod | requestHandlers | handles notify requests | | options | requestMethod | requestHandlers | handles options requests | | patch | requestMethod | requestHandlers | handles patch requests | | post | requestMethod | requestHandlers | handles post requests | | propfind | requestMethod | requestHandlers | handles propfind requests | | proppatch | requestMethod | requestHandlers | handles proppatch requests | | purge | requestMethod | requestHandlers | handles purge requests | | put | requestMethod | requestHandlers | handles put requests | | report | requestMethod | requestHandlers | handles report requests | | search | requestMethod | requestHandlers | handles search requests | | subscribe | requestMethod | requestHandlers | handles subscribe requests | | trace | requestMethod | requestHandlers | handles trace requests | | unlock | requestMethod | requestHandlers | handles unlock requests | | unsubscribe | requestMethod | requestHandlers | handles unsubscribe requests |

expressComposer~routeScore : Object

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | methods | requestMethods | methods for this route | | preHandlers | requestHandlers | handlers that are executed before a route method | | errorHandlers | requestHandlers | handlers for errors within this route | | scope | scopeArg | scope argument for this route | | name | String | the name of the route | | description | String | a description of the route | | path | pathArg | the path for the route |

expressComposer~routerScore : Object

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | preHandlers | requestHandlers | handlers that are executed during this route | | routes | routeScore | Array.<routeScore> | routes for this router | | errorHandlers | requestHandlers | handles errors tha occurred in this route | | scope | scopeArg | scope options to include in this scope | | routers | routerScore | nested routers | | name | String | name of this route | | description | String | a description of this route | | path | pathArg | the path to this route | | | routerOptions | options for the router |

expressComposer~appScore : Object

Kind: inner typedef of expressComposer
Properties

| Name | Type | Description | | --- | --- | --- | | preHandlers | requestHandlers | handlers that are executed for this app | | errorHandlers | requestHandlers | handles errors tha occurred in this route | | scope | scopeArg | scope options to include in this scope | | routers | routerScore | Array.<routerScore> | nested routers | | name | String | name of this route | | description | String | a description of this route | | | appOptions | options for the router | | | appScore | Array.<appScore> | apps for this app | | path | pathArg | the path for the app | | vhost | String | a vhost routing string | | properties | Object | an object used to set express options |