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

@softcripto/jsdoc-route-plugin

v1.0.0

Published

New custom tags to document Expressjs Route

Downloads

8

Readme

@softcripto/jsdoc-route-plugin

New custom tags to document ExpressJs Route.

[TOC]

Install

npm install @softcripto/jsdoc-route-plugin --save-dev

Usage

Add following line to jsdoc.js

{
    ...
    "plugins": [
        ...
        "@softcripto/jsdoc-route-plugin"
    ]
}

For more details please read

Complete Example

/**
 * This is an example of documenting route endpoint
 * 
 * @module /users
 * @route {POST} /users
 * 
 * @renders HTML
 * 
 * @post {String} email - User email address
 * @post {String} password - User secret key
 * 
 * @query {String} token - Access token
 * @query {String} session - Session id
 * 
 * @headers x-cref-token - jwt access token
 * @headers x-cref-other-key - can declare multiple keys for headers
 */

Important - The @module must be included otherwise it won't work as expected.

Define like this - @module /users.


@route

The @route tag allows you to document route endpoint.

It requires 3 parameters.

  1. tag @route
  2. HTTP verb (i.e. POST, GET, PUT, DELETE etc) {POST}
  3. Route path /users

Example:

/**
 * @route {POST} /users
 */

Only one @route tag is expected per route document.


@post

The @post allows you to document any parameters which are passed as form field. It can be either POST or PUT request.

It requires 4 parameters

  1. tag @post
  2. type (i.e. String, Number, Array etc.) {String}
  3. name of parameter email and
  4. description write about the field description

Example:

/**
 * @post {String} email - User email address
 * @post {String} password - User secret key
 */

@query

The @query allows you to document any parameters which are passed as query string in the form of URL (i.e. ?city=NY&state=NY)

It requires 4 parameters, same as @post. Please see above.

Example:

/**
 * @query {String} token - Access token
 * @query {String} session - Session id
 */

@renders

The @renders allow you to document to tell type of output by a URL

Options: HTML|JSON|XML etc.

Example:

/**
 * @renders HTML
 */

@headers

The @headers allow you to document any parameters sent in header.

It requires only 3 parameter @headers name-of-key - description of key

Example:

/**
 * @headers x-cref-token - jwt access token
 */