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 🙏

© 2025 – Pkg Stats / Ryan Hefner

generator-express-component

v0.0.4

Published

An express component generator for Yeoman

Readme

generator-express-component Build Status

![Gitter](https://badges.gitter.im/Join Chat.svg)

Generate various express components for Yeoman generated apps.

Getting Started

Install yo

$ npm install -g yo

Install generator-express-component

To install generator-express-component from npm, run:

$ npm install -g generator-express-component

Initialize the generator

In your application folder run the following:

$ yo express-component

You will be promted for the various configurations values needed to generate express components.

Configuration:

--skip-message             # Suppress generator messages                                  Default: false
--force-config             # Force overwritting of previous config values                 Default: false
--use-defaults             # Skip all prompts and use defaults
--route-use-defaults       # Skip all route prompts and use defaults
--controller-use-defaults  # Skip all controller prompts and use defaults

Also you can pass any sub-generator configuration option to use that value instead of being prompted.

Usage

generator-express-component can generate various express components for your application. It does this through composable sub-generators that can be swapped in and out to customize your components however you like.

Sub-Generators

Route

Generate an express route file, optionally have it registered in the main express app/router file.

Example:

yo express-component:route thing
? What will the url of your endpoint be? (/api/things)

Produces:

server/api/thing/index.js

Configuration:

--route-path      # Path to use for the route
--route-register  # Whether or not to register the route
--route-haystack  # Path to file that the route will be registered in
--route-needle    # String in file to register the route below
--route-express   # The variable name of express in the registered file
--route-url       # Default url for routes
--route-template  # Path to the route template

Controller

Generate an express route controller file, optionally have it required in a corresponding route file.

Example:

yo express-component:controller thing

Produces:

server/api/thing/thing.controller.js

Configuration:

--controller-path      # Path to use for the controller
--controller-register  # Whether or not to register the controller
--controller-haystack  # Path to file that the controller will be registered in
--controller-needle    # String in file to register the controller below
--controller-name      # Default variable name for the controller in registered file
--controller-template  # Path to the controller template

Endpoint

A hookFor express-component:route and express-component:controller by default.

Example:

yo express-component:endpoint thing
? What will the url of your endpoint be? (/api/things)

Produces:

server/api/thing/index.js
server/api/thing/thing.controller.js

Configuration:

--express-component:route       # express-component:route to be invoked
--express-component:controller  # express-component:controller to be invoked

License

MIT License