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

hapi-ending

v1.0.1

Published

Creates documentation of the endpoints of an application

Downloads

137

Readme

Hapi Ending

Lists routes, parameters, and validation constraints for HAPI version 17.x.

CircleCI JavaScript Style Guide

Thanks

Original plugin by Antony Jones, updated for Hapi v17+ by Yulia Tenincheva

  • For HapiJS < v17, use branch hapi-pre-v17 or npm tag 0.9.2
  • For HapiJS > v17, use master, or npm tag > ^1.0.0

What it looks like

Configuration

Currently you can configure the baseUrl which is useful if you want to copy and paste urls, and whether the plugin is enabled or not. Disabling the plugin is highly advised for production environments.

var options = {
    baseUrl: 'http://your.domain:1234' // defaults to protocol-less server host+port,
    enabled: true // defaults to false,
    assetsPath: '/mount-point-for-plugin-assets' // defaults to 'assets' - change if this conflicts with your own routes,
    logoUrl: 'http://example.net/logo.webp'
}

Live Demo

To run a quick local demo, use the npm target 'demo':

npm run demo

Usage

Install the plugin in the standard way:

server.register([
    {
        plugin: require('hapi-ending'),
        options: options
    }
], (err) => {
    ...
}

Describing endpoints

You can add a description to routes using the parameters 'description', 'tags', and 'notes' as follows:

    {
        method: 'GET',
        path: '/you/{foo}/name/{baz}',
        options: {
            description: "Describe your endpoint here",
            tags: ['foo', 'authenticated', 'any tag']
            validate: {
                query: {
                    a: Joi.number().describe('This is where you put the number of As'),
                    now: Joi.boolean().describe('Whether I should do it now or later')
                },
                params: {
                    foo: Joi.number().describe('It should more than likely be a number'),
                    baz: Joi.string().describe('Some string thing goes here')
                }
            },
            notes: [
                'This is just a note'
            ]
        },
        handler: function(request, h) {
            ...
        }
    }

Private endpoints

Adding 'private' to any endpoint's tags will make the endpoint private (i.e. unlisted by the plugin)