0.1.0 • Published 10 months ago

frodo-streamline v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Tool for pushing multiple objects from an array to an API

This tool can be used to send multiple requests to an API. Each reqest sends data from a predefined array.

Example use cases

  • API testing
  • data migration

Requirements

Node version >= 18.16.0

Usage

  • create a folder in the project root directory to store all related files for example pusher
  • create frodo.settings.js file in the root project directory
module.exports = {
    comments: {,
        outputDirectory: 'Directory to store output files',
        saveDirectory: 'Directory to store save files',
    },
    outputDirectory: './pusher/output/',
    saveDirectory: './pusher/save/',
};
  • start sending requests using
npx frodo .\pusher\config\sample.config.json .\pusher\data\sample.data.json

Config file example

{
  "comments": {
    "id": "Project id - should be unique",
    "requestEndpoint": "URL to push data to",
    "requestHeaders": "HTTP headers to be added to each request",
    "requestMethod": "Push method to be used",
    "requestsInBatch": "Concurent request count",
    "requestPercent": "How much data from the data json should be pushed in percent",
    "compareKeyName": "Key from the data object to be used for matching agains the response in the output log"
  },
  "id": "dev-test",
  "requestEndpoint": "http://127.0.0.1:8888/api_mock",
  "requestHeaders": {
    "content-type": "application/json",
    "X-Token": "123asd456"
  },
  "requestMethod": "post",
  "requestsInBatch": 2,
  "requestPercent": 50,
  "compareKeyName": "id"
}

Config file docs

OptionValueDescription
idstringProject id - should be unique
requestEndpointstringURL to push data to
requestHeadersobjectHTTP headers to be added to each request
requestMethodstringPush method to be used
requestsInBatchnumberConcurent request count
requestPercentnumberHow much data from the data json should be pushed in percent
compareKeyNamenumberKey from the data object to be used for matching agains the response in the output log

Changelog

  • v0.1.0
    • push as an npm package

Donate

If you find this piece of code to be useful, please consider a donation :)

paypal

0.1.0

10 months ago