Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ng-apimock/core

ng-apimock44.4kMIT3.12.0TypeScript support: included

ng-apimock core module

apimock, ng-apimock, http, api

readme

@ng-apimock/core

npm Build Status Quality Gate Status Dependabot Status License ts jest Commitizen friendly semantic-release npm downloads

Introduction

ng-apimock is a modular Node.js framework that provides the ability to use scenario based api mocking.

You can use it for:

Installation

yarn add @ng-apimock/core --dev

Minimal setup example (serve.js)

This is a minimal setup example of how you can manually use @ng-apimock/core

const apimock = require('@ng-apimock/core');
const express = require('express');
const app = express();
app.set('port', 9999);

apimock.processor.process({
    src: 'mocks'
});

app.use(apimock.middleware);

app.listen(app.get('port'), () => {
    console.log('@ng-apimock/core running on port', app.get('port'));
});

To start up the script just type:

node serve.js

Minimal setup example (serve.ts)

This is a minimal setup example in TypeScript of how you can manually use @ng-apimock/core

import * as apimock from '@ng-apimock/core';
import express, { Application } from 'express';
const app: Application = express();
app.set('port', 9999);

apimock.processor.process({
    src: 'mocks'
});

app.use(apimock.middleware);

app.listen(app.get('port'), () => {
    console.log('@ng-apimock/core running on port', app.get('port'));
});

Endpoints

There are a few endpoints available when you startup @ng-apimock/core:

  • /ngapimock/info - responsible for providing information of the running instance
  • /ngapimock/health - responsible for providing status information
  • /ngapimock/health/readiness - readiness probe
  • /ngapimock/health/liveness - liveness probe

Contact

We have a few channels for contact:

Extensive documentation

License

@ng-apimock is MIT licensed.

changelog

Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.12.0 (2024-04-05)

Features

  • add override ipaddres configuration option (#1070) (72b4fd8)

3.11.2 (2023-11-14)

Bug Fixes

  • nested body matching should sort on accuracy (6584d66)

3.11.1 (2023-11-14)

Bug Fixes

  • nested body matching should sort on accuracy (02bc266)

3.11.0 (2023-04-13)

Features

  • add urlencoded and text middleware support (#1064) (75e02bc)

3.10.0 (2023-03-30)

Features

3.8.0 (2023-03-22)

Features

  • 🎸 add delay per response as override to mock (b588e5c), closes #246

3.7.0 (2023-01-25)

Features

  • 🎸 add /state endpoint (ec1ea98)

3.6.1 (2023-01-14)

Bug Fixes

3.6.0 (2022-12-08)

Features

  • 🎸 update dependencies (76c9216)

3.5.1 (2022-10-05)

Bug Fixes

  • similar mocks resulting in false positives (#926) (d9a069c)

3.5.0 (2022-05-16)

Features

3.4.0 (2021-11-29)

Features

3.3.0 (2021-11-09)

Features

  • 🎸 Bump version of node-fetch to 2.6.6 (#632) (e6cbcad)

3.2.0 (2021-10-15)

Features

  • Information endpoint accessible under /ngapimock/info
  • Health endpoint accessible under /health, /health/readiness and /health/liveness

Refactorings

  • Presets are now created in under .ngapimock/generated
  • Mocks are now created in under .ngapimock/generated

3.1.0 (2021-09-06)

Features

  • added error-message in case of preset referencing an unknown mock (#556) (e205092)

3.0.3 (2021-07-27)

Bug Fixes

  • 🐛 add logging in try/catch - mock-request-handler (8aacc5e), closes #421

3.0.2 (2021-07-21)

Bug Fixes

  • 🐛 add logging in try/catch - mock-request-handler (#502) (fd3e09c), closes #421

3.0.1 (2021-06-02)

Bug Fixes

3.0.0 (2021-06-02)

chore

BREAKING CHANGES

  • 🧨 NodeJs v10 dropped

2.7.1 (2021-04-15)

Bug Fixes

2.7.0 (2021-04-11)

Features

2.6.0 (2021-04-06)

Features

  • create presets: add functionality to add presets and mocks to preset (#393) (45b8c00)

2.5.0 (2021-03-08)

Features

2.4.0 (2020-12-01)

Features

  • Support file watching for patterns other than mocks (#236) (#257) (970eb84)

2.3.2 (2020-07-16)

Bug Fixes

  • 🐛 log no matching mock error while handling then clause (b83ee87), closes #91

2.3.1 (2020-07-16)

Bug Fixes

  • 🐛 log no matching mock error while handling then clause (#92) (3118fd9), closes #91

2.3.0 (2020-07-15)

Features

2.2.0 (2020-07-14)

Features

  • 🎸 implement then clause functionality (#81) (8486be7), closes #80

2.1.0 (2020-07-08)

Features

  • 🎸 make endpoints base path configurable (#78) (59fdd27), closes #76

2.0.1 (2020-06-08)

Bug Fixes

  • 🐛 method GET and HEAD should not add a body while recording (aee7f9d), closes #31

2.0.0 (2020-06-08)

chore

  • 🤖 use eslint (875808c)
  • 🤖 add ide directory to gitignore (19648da)
  • 🤖 exclude dist folder from tests (8dddbc6)
  • 🤖 use jest instead of sinon (f49efcc)
  • 🤖 add github workflow - ci (0653146)
  • 🤖 add commitizen (832e779)
  • 🤖 update project dependencies (63319b4)
  • 🤖 update readme with body-parser limit info (d2e91dc)
  • 🤖 update eslint dependencies (25b4e91)

ci