@keepi/keepi-utils
v1.0.28
Published
Keepi utils
Downloads
8
Readme
keepi-utils
Just utility module for:
- Log message
- Http request (axios)
- Mongodb (moongose)
- Elasticsearch (elasticsearch)
Using log Helper
const { Log } = require('@keepi/keepi-utils');
Log.print('Just a log', { ...optionalData });
Log.success('Successs log', { ...optionalData });
Log.error('Log error', { ...optionalData });
Using httpRequest Helper
const { HttpRequest } = require('@keepi/keepi-utils');
await HttpRequest.post('url').body({ ...data }).build();
Using Mongodb
const { Mongodb } = require('@keepi/keepi-utils');
// Open connection
await Mongodb.connect(process.env.MONGODB_URI);
// Collection usage
await Mongodb.get('collectionName').findOne();
Using Elasticsearch
const { Elastic } = require('@keepi/keepi-utils');
const index = 'my-index';
const rows = [
{ name: 'Sarah Connor' }
];
await Elastic.bulkInsert(index, rows);