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

mu-koan-generator

v1.1.0

Published

A Koa scaffolding generator for JSON REST APIs

Downloads

4

Readme

mu-kōän-generator 公案-ジェネレータ

Build Status codecov.io MIT License

Installation

$ npm i -g mu-koan-generator

Usage

To get started with a Koa 2.0.0+ REST JSON API use the command line executable mu-koan(1) to generate an application as shown:

  • Create the application:
$ mkdir my-awesome-api && cd my-awesome-api
$ mu-koan

info: [mu-koan]    Creating project "my-awesome-api" into [/home/you/dev/my-awesome-api]
info: [mu-koan]    Created /home/you/dev/my-awesome-api
info: [mu-koan]    Created /home/you/dev/my-awesome-api/.editorconfig
info: [mu-koan]    Created /home/you/dev/my-awesome-api/.eslintrc
info: [mu-koan]    Created /home/you/dev/my-awesome-api/.gitignore
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app.js
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/config
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/config/index.js
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/config/properties.json
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/logger.js
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/routes
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/routes/status.js
info: [mu-koan]    Created /home/you/dev/my-awesome-api/app/server.js
info: [mu-koan]    Created /home/you/dev/my-awesome-api/build.json
info: [mu-koan]    Created /home/you/dev/my-awesome-api/gulpfile.js

This will run npm init and npm install after generating the initial scaffolding.

  • Fire it up:
$ npm start

[12:59:48] Using gulpfile ~/dev/js/my-awesome-api/gulpfile.js
[12:59:48] Starting 'default'...
[12:59:48] Starting 'eslint'...
[12:59:49] Finished 'eslint' after 736 ms
[12:59:49] Starting 'nodemon'...
...
2016-07-22 12:59:49,648 - info: [my-awesome-api] Starting and configuring Koa server
2016-07-22 12:59:49,662 - info: [my-awesome-api] Configuring routes for [/api/status]
2016-07-22 12:59:49,671 - info: [my-awesome-api] ✔ Koa server listening on 127.0.0.1:3000 [development]
  • Check everything's working as expected by requesting /api/status. In a new terminal session, run:
$ curl http://localhost:3000/api/status
{
  "success": true,
  "name": "my-awesome-api",
  "version": "1.0.0-dev",
  "timestamp": "Jul 19, 2016 4:31 PM",
  "process": {
    "platform": "linux",
    "pid": 24238,
    "mem": {
      "rss": 49418240,
      "heapTotal": 34317856,
      "heapUsed": 23951544
    }
 }

You can change or remove the /api namespace by modifying "koa.routes.prefix" option on app/config/properties.json or by starting the API with npm start -- --koa.routes.prefix foo.

Command line interface

Usage: mu-koan [-f --force] [-v]

Options:
  -h, --help     Show help                                             [boolean]
  -v, --verbose  Sets the verbosity level for log messages               [count]
  -V, --version  Show version number                                   [boolean]
  --name                                            [default: (generated-value)]

https://github.com/nfantone/mu-koan-generator


https://github.com/nfantone/mu-koan-generator

Features

Along with a working webserver, the generator creates some common files that feature additional functionality or help you follow standard practices, such as:

  • A gulpfile.js with some common tasks like gulp eslint for linting or gulp nodemon to start a nodemon process.
  • Linting rules based on xo-space and semistandard ESLINT configurations.
  • An .editorconfig file.
  • A .gitignore with many common entries (thanks to https://gitignore.io).
  • Includes mu-kōän as a dependency, so you get many helpful Koa middlewares out-of-the-box.
  • Includes mu-kōän-router as a dependency for automatic controller discovery: just drop a .js file under /routes.
  • A readily configured winston logger at app/logger.js.
  • A routes/status.js controller that prints out simple information on the running process on GET /api/status.
  • Stores its configuration on an nconf instance, supporting command line arguments, environment variables and a config/properties.json file as sources.

License

MIT