Restify Utils
Install
npm i restify-utils -S
Usage
Main function
const attach = require('restify-utils')(configuration, endpointsDir, middlewareDir)
returns Function:
- Function(server, family, prefix = '/api') with extra properties:
- endpoints
- middleware
Populates configuration.models
Goes through endpoints, that are in format of the following:
exportsVERB = path: '/path/relative/to/prefix/family' middleware: 'middlewareName' handlers: { } { } ;
It will be attached to VERB ${prefix}/${family}/path/relative/to/prefix/family
with 2 versions: 1.0.0 and 1.1.0
Endpoints, middleware, models
- Models - instances of classes in the models folder:
- User
- Endpoints - endpoints from the endpointsDir
- Middleware - middleware from the middlewareDir