# jack-api-mock

> Project provides mocking capabilities for RHOAS APIs. Mock supports in memory storage to give developers abstraction of running service.

Latest version **1.5.0-beta1** (published 2023-03-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install jack-api-mock
pnpm add jack-api-mock
yarn add jack-api-mock
bun add jack-api-mock
```

Provides the command `asapi`.

## Health

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

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.5.0-beta1 |
| Published | 2023-03-27 |
| First published | 2023-03-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Red Hat Developers |
| Maintainers | jackdelahunt |

## Links

- npm: https://www.npmjs.com/package/jack-api-mock
- Repository: https://github.com/redhat-developer/app-services-sdk-js
- Homepage: https://github.com/redhat-developer/app-services-sdk-js#readme
- Issues: https://github.com/redhat-developer/app-services-sdk-js/issues
- npm.io page: https://npm.io/package/jack-api-mock

## Dependencies (5)

- [cors](https://npm.io/package/cors.md) 2.8.5
- [yargs](https://npm.io/package/yargs.md) 17.6.2
- [nanoid](https://npm.io/package/nanoid.md) 3.3.4
- [express](https://npm.io/package/express.md) 4.18.2
- [openapi-backend](https://npm.io/package/openapi-backend.md) 5.6.0

## Recent versions

- 1.5.0-beta1 (latest) — 2023-03-27
- 1.4.0 — 2023-03-27
- 1.3.0 — 2023-03-27
- 1.1.0 — 2023-03-27
- 1.0.0 — 2023-03-27

## README

## API Mock for RHOAS APIs

Project provides mocking capabilities for RHOAS APIs.
Mock supports in memory storage to give developers abstraction of running service.

### Using API Mock

![](https://img.shields.io/npm/v/@rhoas/api-mock)

Every SDK provided by RHOAS has available API mock.
Mock provides simulation of  **in memory** implementation of APIs that 
can be used for development and testing.


1. Inline install and usage
```
npx @rhoas/api-mock
```

2. Container image

```
docker run  -p 8080:8000 quay.io/rhosak/api-mock
```

3. Using as CLI

```
npm install -g @rhoas/api-mock
## Run CLI
asapi
```

Starting mock with sample data present:

```shell
asapi --pre-seed
```

### Instances API mapping pattern

Mock provides support for managemement and instances APIs

Instance API use following prefixes

- `/data/kafka` for kafka instance
- `/data/service-registry` for service registry instance

To simulate multiple instances please run many instances of mock.

## Local development

```
yarn
yarn build
yarn start # API running at http://localhost:9000
```

## Environment variables

`CUSTOM_PORT` - custom port number used default is 8000

`CUSTOM_HOST` - custom url used in returned data. default http://localhost

`RESOURCE_OWNER` - provide custom owner value as we do not have ability to detect it in mock.
For example: "RESOURCE_OWNER=wtrocki_kafka_devexp yarn start"

`AMS_QUOTA_TYPE` - provide the quota type to be mocked. The valid values are - "trial", "standard" and "marketplace".

## Build container

```
docker build -t quay.io/rhosak/api-mock .
docker push quay.io/rhosak/api-mock
```

## API Clients

You can call api by starting individual web clients per api
or running examples against mock.

```
yarn api:kafka-management
yarn api:kafka-instance
yarn api:registry-management
yarn api:registry-instance
```

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