Registry / devops / teys-rest

teys-rest

JSON →
library3.2.4jsnpmunverified

Teys-rest v3.2.4 is a TypeScript wrapper around restify for quickly building REST API servers using annotations and class-based controllers. It supports two modes: a classic API server and an SPA server that serves a single-page application alongside the API. Controllers extend RestController and have dependencies injected via teys-injector. It uses modern TypeScript and ESM. Release cadence is unclear; last update appears stable but low activity.

npm install teys-rest
INSTALL
IMPORT
SIG · TEYS-REST
T
teys-rest
devopsjavascriptv3.2.4
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.

ApiServer
import { ApiServer } from 'teys-rest'
const { ApiServer } = require('teys-rest')
ESM-only package; CommonJS require will fail.
SpaServer
import { SpaServer } from 'teys-rest'
Used for SPA mode.
RestController
import { RestController } from 'teys-rest'
Base class for all controllers.

Shows how to define a controller with two endpoints, register it with ApiServer, and start the server.

import { ApiServer, RestController, Get, Post } from 'teys-rest'; import { Request, Response } from 'restify'; class PingController extends RestController { @Get('/ping') ping(req: Request, res: Response): void { res.send(200, { message: 'pong' }); } @Post('/echo') echo(req: Request, res: Response): void { res.send(200, { echo: req.body }); } } const api = new ApiServer(); api.start() .then(() => api.registerControllers(PingController)) .then(() => console.log('Server running on port 3000')) .catch(err => console.error(err));
Debug
Known issues
breakingPackage is ESM-only; require() will throw a Module not found error.
fix
Use import syntax or ensure your project is configured for ESM (e.g., type: 'module' in package.json).
affects: >=3.0.0
gotchaControllers must extend RestController; otherwise, registration fails silently or throws.
fix
Extend RestController for all controllers.
affects: >=3.0.0
deprecatedVersions before 3.0.0 used a different API; migration required.
fix
Upgrade to v3.2.4 and follow current documentation.
affects: <3.0.0
gotchaDependency teys-injector is required for property injection but not listed as a peer dependency.
fix
Ensure teys-injector is installed (npm install teys-injector).
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'teys-injector'
Missing required dependency that is injected into controllers.
fix
Install teys-injector: npm install teys-injector
TypeError: Class constructor RestController cannot be invoked without 'new'
Using require() on an ESM default export incorrectly.
fix
Use import statement: import { RestController } from 'teys-rest'
Upgrade
Version history
3.2.4latest on npm
Audit
Dependencies
restifyrequiredunderlying HTTP server framework
Agent activity
8 hits · last 30 days
node
8
Resources
teys-rest — npm install teys-rest · libregistry