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

bodyapi2

v3.57.0

Published

Genera más rápido tu CRUD básico! Esto ayuda a que puedas desplegar más rapido a contenedores Docker para tener una mejor orquestación de microservicios!

Downloads

368

Readme

bodyapi2

bodyapi2 es una herramienta CLI que te permite generar de forma rápida y sencilla la estructura base para un CRUD usando Express.js y bases de datos como MSSQL, PostgreSQL, MariaDB, MySQL y MongoDB.

ACTUALMENTE SOLO ESTÁ ACTIVO EL MÓDULO DE MSSQL PARA INYECCIÓN DE MODELOS.
Aun así, puedes crear el proyecto inicial con cualquiera de los motores.


Instalación y uso básico

npx bodyapi2@latest

Esto lanzará un asistente donde se te preguntará:

  • Nombre del proyecto.
  • Nombre del recurso principal (ej: productos).
  • Motor de base de datos (mssql, mysql, postgresql, mariadb, mongodb).
  • Si deseas conectarte directamente a tu base de datos (opcional).
  • Si presionas no, se generará una base básica de tu proyecto, manualmente meterás tus credenciales en el .env
  • Cadena de conexión (solo para MSSQL de momento).
  • Cadena de texto: Server=localhost;Database=tubd;User Id=sa;Password=Tucontraseña;Encrypt=false;TrustServerCertificate=true;

Si no tienes BD creada se crea sola

Estructura generada

tu-proyecto/
├── src/
│   ├── controllers/
│   ├── routes/
│   ├── models/          # (opcional, si generas con comando `model`)
│   ├── db/
│   └── index.js
├── .env
└── package.json

Comando para crear modelos

Para generar un modelo de tabla:

npx bodyapi2 model tamales

Esto crea el archivo:

src/models/tamales.model.js

Contenido inicial:

// Modelo de tabla para 'tamales'
export const tamalesModel = {
  tableName: 'tamales',
  columns: {
    id: 'INT PRIMARY KEY IDENTITY(1,1)',
    nombre: 'VARCHAR(100) NOT NULL'
    // Agrega más columnas aquí
  }
};

Crear tabla SQL desde un modelo (solo MSSQL por ahora)

Una vez creado el modelo, puedes inyectarlo a tu base de datos SQL Server:

npx bodyapi2@latest model tamales create

Esto también generará automáticamente:

  • controllers/tamales.controllers.js
  • routes/tamales.routes.js

Advertencias importantes

  • Aún no se actualiza automáticamente la estructura de las tablas en SQL Server si cambias el modelo después. Se está trabajando en esta función.
  • Si modificas el modelo (por ejemplo, cambias nombre por articulo), el CRUD sí se actualizará, pero no cambiará la tabla en la base de datos ya creada.
  • Estará disponible en la próxima actualización major.
  • Sí el npx bodyapi2 model 'nombre del articulo' no crea la carpeta models, creala (momentaneamente, se trabaja en arreglar) models -> nombrearticulo.models.js

export const nombrearticuloModel = { tableName: 'nombrearticulo', columns: { id: 'INT PRIMARY KEY IDENTITY(1,1)', nombre: 'VARCHAR(100) NOT NULL' // Agrega más columnas aquí } };

  • Esperemos resolverlo pronto!
  • Posteriormente ejecutar npx bodyapi2 model 'nombre del articulo' create para la inyección de tablas a mssql

❤️ 360flip Team

   .:::.     .:::.
  :::::::. .:::::::     bodyapi2
  :::::::::::::::::    made with love by
  ':::::::::::::::'     360flip team
    ':::::::::::'  

¡Esperamos que te ayude a arrancar tus microservicios más rápido!
Cualquier idea o sugerencia es bienvenida

  • Haremos una comunidad dónde podamso explotar el conocimiento! Originalmente está pensado en ingenieros IoT, pero también para personas que inician, o usan el método tradicional para sus apis!
  • Nuestra página es www.togetheworld.com
  • Nos encontramos en desarrollo de cursos para UDEMY, estaremos subiendo información pronto! :D