Introducing Mocking Hans - An open source tool for creating fake APIs

Click for: original source

An article by Kevin about Hans. Hans is a small Node application for faking APIs - but not just a single REST API using HTTP. It allows for creating multiple APIs using different ports and protocols (like native WebSockets or even GraphQL). It supports multi-port/app API mocking, Express, Socket.io and native WebSocket.

On top of that it is written entirely in TypeScript which allows for some neat abstractions and sharing models between your real application and your fake API. And, of course, everything is licensed under MIT.

The article then quickly dives into details:

  • Basic example
  • How to use Adapters
  • Requests, Responses
  • Middleware
  • State

Small, nice library. Hans integrates Faker by default, providing useful methods for generating fake data. Link to repository provided.

[Read More]

Tags apis nodejs restful web-development