A lightweight middleware for Express and Connect to emulate REST APIs for development and testing. Version 0.0.4 provides a simple configuration-driven approach to mock HTTP endpoints with support for GET, POST, query parameters, custom status codes, and timeouts. Supports modular mock file structures and presets for different response scenarios. Suitable for frontend development without a live backend, but limited to basic REST emulation without advanced features like dynamic responses, validation, or state management.
npm install rest-emulator-whyflyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up an Express server with rest-emulator-whyfly middleware to mock two endpoints with static data and query support.
Use const restEmulator = require('rest-emulator-whyfly');Ensure query string in config matches the exact format as sent by the client (e.g., 'name=Miami' not 'name=Miami&' ).
Use 0 for immediate response or a positive integer for delay.
Use const restEmulator = require('rest-emulator-whyfly');Require 'rest-emulator-whyfly' instead of 'restEmulator'.