Skip to content

ng-apimock/core

Repository files navigation

@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.