teapotapps
v1.0.6
Published
The official runtime framework for TeapotApps.
Readme
TeapotApps Framework
Official runtime framework and opinionated Express primitives for TeapotApps applications.
Installation
npm install teapotappsFeatures
- Standard REST API Response: Consistent
{ data, meta, status }response structure viaresponseApi. - Routing Group: Modular route prefixes and middleware grouping via
routeGroup. - Declarative Validator: Request schema validation with
validateand built-inrules. - Async Handler: Automatic promise error forwarding with
asyncHandler. - JWT & Auth Middlewares: Built-in
verifyTokenandJwtHandlers. - SSR Helper: Lightweight HTML rendering helper with
render.
Usage Example
import { Router } from 'express';
import { routeGroup, responseApi, asyncHandler, validate, rules } from 'teapotapps';
const router = Router();
routeGroup(router, '/api/v1', [], (api) => {
api.get('/health', asyncHandler(async (req, res) => {
return responseApi(res, { status: 'healthy' }, null, 'System is operational');
}));
});
export default router;