Skip to Content
Mock ServerPre-Installed Libraries

Using Pre-Installed Libraries

MockServer comes with popular JavaScript libraries pre-installed, so you can use them directly in your mock definitions:

const _ = require('lodash'); const moment = require('moment'); const { faker } = require('@faker-js/faker'); mock.define('/test-libs', 'GET', (req, res) => { const randomUser = { id: faker.datatype.uuid(), name: faker.name.findName(), email: faker.internet.email() }; res.json({ currentDate: moment().format(), activeUsers: _.filter([{ active: true }, { active: false }], { active: true }), randomUser: randomUser }); });

These libraries help you create rich, dynamic responses easily without the need for additional installations. If you need a library that is not listed, please reach out to APIGIT, and we will evaluate and add it quickly. The supported libraries include:

  • @faker-js/faker (v9.2.0) - data generator
  • ajv (v8.17.1) - JSON schema validation
  • base64-js (v1.5.1) - Base64 encoding/decoding
  • cors (v2.8.5) - Cross-Origin Resource Sharing middleware
  • jsonwebtoken (v9.0.2) - JWT creation and verification
  • lodash (v4.17.21) - general utility
  • moment (v2.30.1) - time and date handling
  • uuid (v11.0.3) - UUID generator
  • validator (v13.12.0) - validation helper

If you foud any other popular libraries useful and want to get them pre-installed, please feel free to send request to support@apigit.com.

Last updated on