Universis api server default document numbering service
npm i @universis/docnumbers
Register DocumentNumberService
in application services:
# app.production.json
"services": [
...,
{
"serviceType": "@universis/docnumbers#DocumentNumberService",
"strategyType": "@universis/docnumbers#DefaultDocumentNumberService"
}
]
Add DocumentNumberSchemaLoader
to schema loaders
# app.production.json
{
"settings": {
"schema": {
"loaders": [
...,
{
"loaderType": "@universis/docnumbers#DocumentNumberSchemaLoader"
}
]
}
}
}
Use settings/universis/docnumbers
section to configure the usage of document verifier services:
"docnumbers": {
"origin": "https://api.example.com/",
"rateLimit": {
"windowMs": 300000
"max": 5
}
}
string
A string which represents the remote address where document verifier service will be accessible by end-users.
object
@universis/docnumbers
uses express-rate-limit configuration for limiting the amount of requests against verification services. The default values are:
{
windowMs: 300000, // 5 minutes
max: 20, // 20 requests
standardHeaders: true,
legacyHeaders: false
}
string
An ISO 8601 duration which represents the amount of time where the usage of short document code will be valid. The default value is P1M
{
"shortDocumentCodeDuration": "P2M" // two months
}