{"id":43768,"library":"rest-docs","title":"rest-docs","description":"rest-docs (v1.1.1) is a RESTful HTTP client library that auto-generates API documentation and provides a monitoring dashboard. It bundles a Node.js HTTP server with automatic CRUD route generation for databases (PostgreSQL, MySQL, MariaDB, MSSQL, SQLite3) via Knex. Unlike generic API builders, it exposes live docs and monitoring endpoints out of the box. The last release appears to be 1.1.1 with no recent updates; it uses CommonJS and requires manual driver installation.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/victor-valencia/rest-docs","tags":["javascript","rest","http","api","rest-docs","PostgreSQL","MySQL","MariaDB","MSSQL"],"install":[{"cmd":"npm install rest-docs","lang":"bash","label":"npm"},{"cmd":"yarn add rest-docs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rest-docs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Database query builder","package":"knex","optional":false},{"reason":"PostgreSQL driver","package":"pg","optional":true},{"reason":"MySQL/MariaDB driver","package":"mysql","optional":true},{"reason":"MSSQL driver","package":"mssql","optional":true},{"reason":"SQLite driver","package":"sqlite3","optional":true},{"reason":"For .env file loading","package":"dotenv","optional":true}],"imports":[{"note":"The package uses CommonJS only; ESM imports will fail.","wrong":"import rest_docs from 'rest-docs'","symbol":"rest-docs","correct":"const rest_docs = require('rest-docs')"},{"note":"The constructor is the default export; invoking .rest() is not needed.","wrong":"var rest = new rest_docs.rest()","symbol":"rest_docs","correct":"const rest_docs = require('rest-docs'); var rest = new rest_docs();"},{"note":"First argument is the database type (string), second is the config object.","wrong":"rest.startDBServer({...})","symbol":"startDBServer","correct":"rest.startDBServer('mysql', {...})"}],"quickstart":{"code":"const rest_docs = require('rest-docs');\nvar rest = new rest_docs();\n\nrest.startServer({\n  ip: '127.0.0.1',\n  port: '8080',\n  compression: 'gzip'\n});\n\nrest.startDBServer('mysql', {\n  host: 'localhost',\n  port: 3306,\n  user: 'root',\n  password: process.env.DB_PASSWORD ?? '',\n  database: 'medic',\n  timezone: '+00:00'\n});\n\nconst api_config = {\n  base: '/api',\n  pages: {\n    docs: true,\n    monitor: true\n  },\n  routes: {\n    tb: [\n      {\n        table: 'doctors',\n        event: 'DOCTOR',\n        methods: ['GET', 'POST', 'PUT', 'DELETE'],\n        columns: [\n          {name: 'id', primary: true},\n          {name: 'name'},\n          {name: 'specialty'}\n        ]\n      }\n    ]\n  }\n};\n\nrest.buildRoutes(api_config);","lang":"javascript","description":"Creates a RESTful API server with automatic CRUD routes, live docs, and monitoring for a 'doctors' table in MySQL."},"warnings":[{"fix":"Use require('rest-docs') instead of import.","message":"Package is CommonJS only. Importing via ES6 `import` will fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install one of: pg, mysql, mssql, sqlite3.","message":"Database drivers are not included; must be installed separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Call rest.startDBServer('mysql', { host: ... }) instead of rest.startDBServer({ host: ... }).","message":"The first argument to startDBServer() is the database type (string), not the config object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all column names exist in the database table.","message":"Columns in routes config have no 'type' field; validation may fail for non-string columns.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set compression to a valid string or omit it.","message":"The 'compression' option must be a string like 'gzip' or 'deflate'; boolean or other types may be ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the correct table name casing.","message":"Table names are case-sensitive; use the exact case as in the database.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.1':66 'api':18,47,82 'appear':63 'auto':16 'auto-gener':15 'automat':32 'box':59 'builder':48 'bundl':26 'client':12 'commonj':73 'crud':33 'dashboard':24 'databas':37 'doc':3,6,52,85 'document':19 'driver':77 'endpoint':55 'expos':50 'generat':17,35 'generic':46 'http':11,29,81 'instal':78 'javascript':79 'knex':44 'last':61 'librari':13 'live':51 'manual':76 'mariadb':40,88 'monitor':23,54 'mssql':41,89 'mysql':39,87 'node.js':28 'postgresql':38,86 'provid':21 'recent':69 'releas':62 'requir':75 'rest':2,5,10,80,84 'rest-doc':1,4,83 'rout':34 'server':30 'sqlite3':42 'unlik':45 'updat':70 'use':72 'v1.1.1':7 'via':43","created_at":"2026-06-05T17:01:23.172139+00:00","updated_at":"2026-06-05T17:01:23.172139+00:00","problems":[{"fix":"npm install pg --save","cause":"PostgreSQL driver not installed","error":"Error: Cannot find module 'pg'"},{"fix":"Replace import with const rest_docs = require('rest-docs')","cause":"Using ES6 import instead of require","error":"rest_docs is not a constructor"},{"fix":"Call rest.startDBServer('mysql', { host: 'localhost', ... })","cause":"startDBServer called without first argument (string)","error":"Cannot read property 'host' of undefined"},{"fix":"Add routes: { tb: [] } to api_config","cause":"Missing routes.tb array in config","error":"TypeError: Cannot read properties of undefined (reading 'forEach')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/victor-valencia/rest-docs#readme","github":"https://github.com/victor-valencia/rest-docs","docs":null,"changelog":null,"pypi":null,"npm":"rest-docs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}