@lomray/microservice-attachments v1.0.12
attachments
RPC 2.0 Microservice.
A microservice provides work with attachments for entities from other microservices. For example: images, videos.
Navigation
ENVIRONMENTS:
NODE_ENV- Can beproductionordevelopmentortests. Default:developmentMS_CONNECTION- Invert json host and port (with protocol). Default:http://127.0.0.1:8001MS_CONNECTION_SRV- Invert json connection it is SRV record. Default:falseMS_NAME- Microservice name. Default:attachmentsMS_CONFIG_NAME- Configuration microservice name. Default:configurationMS_WORKERS- Microservice queue workers count. Default:1MS_ENABLE_REMOTE_MIDDLEWARE- Enable remote middleware feature. Set0to disable. Default:1(enabled)MS_STORAGE_TYPE- Microservice storage type.DB_FROM_CONFIG_MS- Get db credentials from configuration microservice. Set0to disable. Default:1DB_URL- Database url connection string. Default:undefined. Please use URL or credentials.DB_HOST- Database host. Default:127.0.0.1DB_PORT- Database port. Default:5432DB_USERNAME- Database user name. Default:postgresDB_PASSWORD- Database password. Default:exampleDB_DATABASE- Database db name. Default:ms-usersMS_GRAFANA_LOKI_CONFIG- Grafana loki config. Default:nullMS_ENABLE_GRAFANA_LOG- Enable grafana loki log (config from configuration ms). Default:0AWS_ACCESS_KEY_ID- AWS access key ID, if you will use S3 to store files (if not configured from remote config.). Default:emptyAWS_SECRET_ACCESS_KEY- AWS secret access key, if you will use S3 to store files (if not configured from remote config.) Default:emptyAWS_REGION- AWS region, if you will use S3 to store files (if not configured from remote config.) Default:emptyAWS_BUCKET_NAME- AWS S3 bucket name, if you will use S3 to store files (if not configured from remote config.) Default:emptyAWS_FROM_CONFIG_MS- Get AWS credentials from configuration microservice. Set0to disable. Default:1STORAGE_PATH_PREFIX- Path (url) prefix for attachments. Default:emptyIMAGE_CONFIG_FROM_CONFIG_MS- Get image processing configuration from configuration microservice. Set0to disable. Default:1IMAGE_PROCESSING_CONFIG- Image processing configuration JSON string. Default:{}
HOW TO RUN:
- Run
Inverted Jsonjob server.
docker run -it -p 8001:8001 lega911/ijson --log 47- Run microservice (please, see
ENVIRONMENTSabove for understand config)
npm run start:dev- Make some request
curl localhost:8001/ms/attachments -d '{"id": "unique-id", "method": "demo", "params": {}}'If you use JetBrains IDE, try to find run configurations in .run
You can also install microservice like npm package:
npm i --save @lomray/microservice-attachmentsHOW TO DEVELOP:
For develop this microservice, preferred use TDD technique.
You can run all tests with watch flag or run one test:
// case 1
npm run test -- --watch
// case 2
NODE_ENV=tests TS_NODE_COMPILER_OPTIONS='{"target":"es6"}' mocha --harmony --no-warnings __tests__/your-test-name.ts --require ts-node/register --recursive --watch
// check code coverage
nyc npm run testThat is all. Don't forget install npm dependencies
(in root folder & local folder run: npm ci)
MEMORY USAGE:
Run on typescript: ~200 MB PEAK / ~160 MB
Run on JS: ~38 MB PEAK / ~26 MB
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago