express-registry
Usage
npm i -S express-registry
Description
Express-based mini-framework that let you focus on your application components and avoid express boilerplates. You register your config, librairies and utils in a global singleton registry. Then you can register your middlewares and routes. If you need to make components share informations or communicate, you can use the registry which is an event-emitter.
Example
// index.ts ;;;;;; async { try const config = await ; const registry = ; registry; registry ; catch err console; };
Config
// config/index.jsconst env = port: processenvPORT || 5000 ;
You should put env and all config required to make your app run
Lib
All helpers like logger, mailer, ...
Service
Should contain database connexion, queue...
Middleware
All express middlewares like body parser, session, form parser, passport...
Route
Contain API Endpoints and error handlers
return method: 'get' // |'put'|'post'|'delete'|'all' url: '/test' handler: async res status200