# measurio

> Measure and get statistics about your api!

Latest version **1.0.7** (published 2021-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install measurio
pnpm add measurio
yarn add measurio
bun add measurio
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2021-08-31 |
| First published | 2021-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Anirban Bala Pranto |
| Maintainers | bash.ketchum |

## Links

- npm: https://www.npmjs.com/package/measurio
- Repository: https://github.com/anirbanpranto/Measurio
- Homepage: https://github.com/anirbanpranto/Measurio#readme
- Issues: https://github.com/anirbanpranto/Measurio/issues
- npm.io page: https://npm.io/package/measurio

## Dependencies (3)

- [cors](https://npm.io/package/cors.md) ^2.8.5
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [@types/node](https://npm.io/package/@types/node.md) ^16.7.2

## Recent versions

- 1.0.7 (latest) — 2021-08-31
- 1.0.5 — 2021-08-27
- 1.0.4 — 2021-08-27
- 1.0.3 — 2021-08-27
- 1.0.2 — 2021-08-26
- 1.0.1 — 2021-08-26
- 1.0.0 — 2021-08-26

## README

# Measurio
A node module for testing your api performance and correctness. Built for a competition platform that my friends and I are working on.

## How to run
* NPM
```
npm i measurio
```
### Example usage
```js
import { Measurio } from 'measurio'

const url = "http://localhost:3000/someendpoint"
const method = "GET"

const main = async () => {
    const measurio = new Measurio(url, method);

    //example expects a sorted array of the provided values
    const payload = {
        timelimit : 2000,
        case : {1 : [5, 2, 3], 2 : [9, 78, 2, 21, 1]},
        test : {1 : [2, 3, 5], 2 : [78, 21, 9, 2, 1]},
        headers : {
            "Content-type" : "application/json"
        }
    }

    const ans = await measurio.testcase(payload)
    console.log(ans);
}

main()
```

### Example Responses
* Time Limit Exceeded :
```js
{
  code: 2048,
  time: 322.89119999855757,
  message: 'Time limit exceeded, try for a faster solution',
  data: 'ERROR'
}
```
* Wrong Answer :
```js
{
  code: 1024,
  time: 1952.6152000017464,
  message: 'Length of test and length of received object does not match'
}
{
  code: 1024,
  time: 1931.2461000010371,
  message: 'Results differ',
  expected: '1 : ssdfsf',
  received: '1 : undefined'
}
{
  code: 1024,
  time: 1932.8013000003994,
  message: 'Results differ',
  expected: '1 : gnirts',
  received: '1 : ssdfsf'
}
```
* Other error
```js
{
  code: 2048,
  time: 30.61309999972582,
  message: 'Please check your code for errors.',
  data: 'ERROR'
}
```
* Accepted Answer :
```js
{ 
  code: 4096, 
  time: 1953.9976000003517, 
  message: 'Test Passed!' 
}
```

---
_Source: https://npm.io/package/measurio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
