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 🙏

© 2026 – Pkg Stats / Ryan Hefner

route-api-docs

v1.0.3

Published

> **Documentación de API automática, hermosa y ligera para Node.js y Express.**

Readme

📚 Route API Docs

Documentación de API automática, hermosa y ligera para Node.js y Express.

Genera una página de documentación estática profesional escaneando tus comentarios JSDoc. Sin servidores pesados, sin configuraciones complejas, 100% Native Node.js.


✨ Características

  • Zero Config: Escanea tus rutas y genera el HTML automáticamente.
  • Native & Ligero: Sin Webpack, sin Babel, sin dependencias pesadas. Archivos minificados.
  • 4 Temas Integrados: Default, Dark, Pastel y Ocean.
  • Interactividad: Grupos y esquemas colapsables (Details/Summary nativo).
  • Syntax Highlighting: Formateo de JSON estilo Monokai integrado.
  • Responsive: Sidebar adaptable y menú móvil.
  • JSDoc Driven: Documenta tu código donde vive, en los comentarios.

🚀 Instalación

Instala el paquete en tu proyecto:

npm install route-api-docs

🛠 Uso Básico

En tu archivo principal de Express (por ejemplo index.js o app.js):

import express from 'express';
import path from 'node:path';
import { generateDocs } from 'route-api-docs';

const app = express();

// ... tus rutas y configuraciones ...

// Endpoint para servir la documentación
app.get('/docs', (req, res) => {
    // 1. Ruta donde están tus archivos de rutas (con comentarios JSDoc)
    const routesPath = path.join(process.cwd(), 'src/routes');
    
    // 2. Generar el HTML
    const html = generateDocs(routesPath, {
        title: 'Mi API Increíble',
        version: '1.0.0',
        theme: 'dark', // Opcional: default, dark, pastel, ocean
        baseUrl: 'http://localhost:3000' // Opcional: para mostrar URL completa
    });

    res.send(html);
});

app.listen(3000, () => console.log('Docs en http://localhost:3000/docs'));

🎨 Temas Disponibles

Puedes cambiar el aspecto visual pasando la opción theme en la configuración.

| Tema | Previsualización | | ------------------------- | --------------------------------------------------------------------------------- | | Default (Tech Light) | | | Dark (Soft Night) | | | Pastel (Fun & Bright) | | | Ocean (Blue Fresh) | |


📝 Guía de Sintaxis JSDoc

Documenta tus archivos de rutas (.js o .ts) usando los siguientes tags.

1. Definir un Endpoint

/**
 * @endpoint /api/users
 * @method GET
 * @group Usuarios
 * @desc Obtiene todos los usuarios activos.
 * @header {string} Authorization Token Bearer
 * @param {int} page Número de página
 * @return {Usuario} Array de usuarios
 * @status {200} Éxito
 * @example
 * [
 *   { "id": 1, "name": "Alice" }
 * ]
 */
router.get('/users', controller.getUsers);

2. Definir un Schema (Modelo de Datos)

Define tus modelos una vez y reutilízalos en @return o @body.

/**
 * @schema Usuario
 * @desc Usuario registrado en el sistema.
 * @prop {integer} id ID único
 * @prop {string} name Nombre completo
 * @prop {string} email Email del usuario
 */

📌 Lista de Tags Soportados

| Tag | Descripción | Ejemplo | | ----------- | ------------------------------ | --------------------------------- | | @endpoint | Ruta del endpoint | /api/v1/products | | @method | Método HTTP | GET, POST, PUT, DELETE | | @group | Agrupa endpoints en el sidebar | Productos, Auth | | @desc | Descripción corta | Crea un nuevo producto | | @header | Headers requeridos | {string} Authorization | | @param | Parámetros de URL/Query | {int} id ID del producto | | @body | Cuerpo de la petición (JSON) | {string} email | | @return | Tipo de respuesta | {Producto} Objeto creado | | @status | Códigos HTTP posibles | {200} Ok, {404} No encontrado | | @example | Ejemplo JSON de respuesta | (JSON válido debajo del tag) | | @schema | Define un modelo reutilizable | Usuario | | @prop | Propiedad de un schema | {string} name |


🤝 Contribuir

  1. Haz un Fork del proyecto.
  2. Crea una rama (git checkout -b feature/nueva-funcionalidad).
  3. Haz Commit (git commit -m 'Add some feature').
  4. Push a la rama (git push origin feature/nueva-funcionalidad).
  5. Abre un Pull Request.

Creado con ❤️ usando Node.js nativo.