npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mockeroo/mock-responses

v1.4.0

Published

Responses that mock you.

Downloads

412

Readme

@mockeroo/mock-responses

Responses that mock you. An npm package that provides sarcastic, judgmental HTTP responses you can mount in your own Express app.

Try It Live

A live server running this package is available at https://mock-server.mockeroo.workers.dev/

Hit it directly from your terminal — no installation required:

# Project info and available status codes
curl https://mock-server.mockeroo.workers.dev/

# Get a sarcastic 404
curl https://mock-server.mockeroo.workers.dev/404

# Get a sarcastic 500
curl https://mock-server.mockeroo.workers.dev/500

# Or use it as a real mock endpoint in your tests
curl -i https://mock-server.mockeroo.workers.dev/418

Each endpoint returns the actual HTTP status code, so it works as a real mock server for testing error handling.

Installation

npm install @mockeroo/mock-responses

Usage

getResponse(statusCode)

Returns a random sarcastic { status, message } object for the given HTTP status code, or null if unavailable.

const { getResponse } = require('@mockeroo/mock-responses');

const result = getResponse(404);
// { status: 404, message: "Whatever you're looking for, it's not here. Just like my will to help you." }

const missing = getResponse(999);
// null

getAvailableCodes()

Returns a sorted array of all available HTTP status codes.

const { getAvailableCodes } = require('@mockeroo/mock-responses');

console.log(getAvailableCodes());
// [200, 201, 204, 301, 302, 304, 400, 401, 403, 404, ...]

middleware()

Returns an Express router you can mount at any path:

const express = require('express');
const { middleware } = require('@mockeroo/mock-responses');

const app = express();
app.use('/mock', middleware());
app.listen(3000);

This gives you:

  • GET /mock/ — project info and available codes
  • GET /mock/:statusCode — sarcastic response with the real HTTP status code

Example Response

{
  "status": 404,
  "message": "Whatever you're looking for, it's not here. Just like my will to help you."
}

The response actually comes back with HTTP status 404 — so it works as a real mock endpoint for testing how your app handles different status codes. Except now the errors are personal.

Full Example

const express = require('express');
const cors = require('cors');
const rateLimit = require('express-rate-limit');
const { middleware } = require('@mockeroo/mock-responses');

const app = express();

app.use(cors());

const limiter = rateLimit({
  windowMs: 60 * 1000,
  max: 120,
  message: { status: 429, message: "Rate limit exceeded." }
});
app.use(limiter);

app.use('/', middleware());

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Available Status Codes

200 201 204 301 302 304 400 401 403 404 405 408 409 413 418 429 500 502 503 504

Want more? Contribute one!

Contributing

The easiest way to contribute is by adding funny messages to files in the responses/ directory. See CONTRIBUTING.md for guidelines.

License

MIT