Registry / devops / responsio

responsio

JSON →
library0.3.0jsnpmunverified

Responsio is a lightweight TypeScript library for standardizing REST API responses. Current stable version is 0.3.0, released as an early public alpha with ongoing development. It provides a simple wrapper to structure success and error responses consistently, reducing boilerplate in Express/Koa-based APIs. Unlike more opinionated formatters, it focuses on minimal configuration and direct JSON formatting, targeting developers who want a thin utility rather than a full framework add-on.

npm install responsio
INSTALL
IMPORT
SIG · RESPONSIO
R
responsio
devopsjavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

responsio
import responsio from 'responsio'
const responsio = require('responsio')
Package is ESM-only; CommonJS require will fail.
SuccessResponse
import { SuccessResponse } from 'responsio'
import SuccessResponse from 'responsio'
SuccessResponse is a named export, not default.
ErrorResponse
import { ErrorResponse } from 'responsio'
import { Error } from 'responsio'
Error is not exported; use ErrorResponse.

Shows basic usage of responsio.formatSuccess() and responsio.formatError() in an Express app.

import responsio from 'responsio'; const app = require('express')(); app.get('/api/data', (req, res) => { try { const data = { id: 1, name: 'Example' }; res.json(responsio.success(data)); } catch (err) { res.status(500).json(responsio.error('Internal Server Error', 500)); } }); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
deprecatedresponsio.success() and responsio.error() are deprecated in favor of responsio.formatSuccess() and responsio.formatError().
fix
Use responsio.formatSuccess() and responsio.formatError() instead.
affects: >=0.2.0 <=0.3.0
breakingPackage is ESM-only starting from version 0.3.0. Attempting to require() will throw a runtime error.
fix
Use ESM imports or upgrade your project to ESM.
affects: >=0.3.0
breakingDefault export changed from function to object in version 0.3.0. Calling responsio() directly returns an object, not a response.
fix
Use responsio.formatSuccess() or responsio.formatError() methods.
affects: >=0.3.0
gotchaErrorResponse does not automatically set HTTP status codes; you must manually set res.status() before sending.
fix
Chain res.status(code) before res.json() or use the second argument of responsio.error().
affects: >=0.0.1
gotchaTypeScript users: types are bundled but only for main exports; utility types like ResponsePayload are not exported.
fix
Manually define missing types or cast to any.
affects: >=0.2.0 <=0.3.0
Errors
Common errors & fixes
Cannot find module 'responsio'
Running in CJS environment without ESM support.
fix
Add "type": "module" to package.json or use dynamic import().
responsio.success is not a function
Using version 0.3.0 where the API changed to formatSuccess.
fix
Use responsio.formatSuccess() instead.
Unexpected token 'export'
Node.js version too old (<12) or not configured for ESM.
fix
Upgrade Node to >=14 and use "type": "module" in package.json.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
responsio — npm install responsio · libregistry