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 🙏

© 2025 – Pkg Stats / Ryan Hefner

reshttp

v2.0.2

Published

A package to create and manage HTTP status messages for Node.js Express applications.

Downloads

6

Readme


reshttp - HTTP Status Codes and Messages

reshttp is a comprehensive object that contains HTTP status codes and their professional messages. This can be used across your Node.js/Express application to standardize error handling and responses in a formal and consistent manner.

Table of Contents

Overview

The reshttp object includes all major HTTP status codes, from 1xx (Informational) to 5xx (Server Errors), with associated professional messages. These messages are designed to provide clarity and helpful information to both users and developers.

Installation

NPM

npm install reshttp

PNPM

pnpm add reshttp

YARN

yarn add reshttp

BUN

bun add reshttp

Usage

import express from "express";
import reshttp from "reshttp";


console.log(reshttp.okMessage)
console.log(reshttp.okCode)

const app = express();

app.get("/example", (req, res) => {
  if (!req.query.id) {
    return res.status(reshttp.badRequestCode).json({status: reshttp.badRequestCode, message: reshttp.badRequestMessage});
  }
  res.status(reshttp.okCode).send(reshttp.okMessage);
});

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

In this example:

  • If id is missing in the query, it returns a 400 Bad Request with a formal message.
  • If id is provided, it returns a 200 OK response.

Informational Responses (1xx)

| Code | Message | |----------|-----------------------------------------------------------------------------| | 100 | Continue: The server has received the request headers and the client may proceed with the request body. | | 101 | Switching Protocols: The requester has asked the server to switch protocols. | | 102 | Processing: The server has received the request and is processing it, but no response is available yet. | | 103 | Early Hints: The server is sending preliminary headers before the final response. |

Success Responses (2xx)

| Code | Message | |----------|-----------------------------------------------------------------------------| | 200 | OK: The request was successful. | | 201 | Created: The request was successful, and a new resource was created. | | 202 | Accepted: The request has been received but has not yet been acted upon. | | 203 | Non-Authoritative Information: The response contains modified metadata not from the origin server. | | 204 | No Content: The request was successful, but there is no content to send in the response. | | 205 | Reset Content: The server has fulfilled the request and instructs the client to reset the document view. | | 206 | Partial Content: The server is delivering only part of the resource due to a range header sent by the client. |

Redirection Responses (3xx)

| Code | Message | |----------|-----------------------------------------------------------------------------| | 300 | Multiple Choices: The request has multiple possible responses. | | 301 | Moved Permanently: The resource has been moved permanently to a new URL. | | 302 | Found: The resource is temporarily located at a different URL. | | 303 | See Other: The client should retrieve the resource at another URL with a GET request. | | 304 | Not Modified: The resource has not been modified since the last request. | | 307 | Temporary Redirect: The resource is temporarily located at a different URL, but the original method should be used. | | 308 | Permanent Redirect: The resource has been permanently moved to a new URL, and the original method should be used. |

Client Error Responses (4xx)

| Code | Message | |----------|-----------------------------------------------------------------------------| | 400 | Bad Request: The server could not understand the request due to invalid syntax. | | 401 | Unauthorized: The client must authenticate itself to get the requested response. | | 402 | Payment Required: Payment is required to access the resource. | | 403 | Forbidden: The client does not have permission to access the requested resource. | | 404 | Not Found: The requested resource was not found on the server. | | 405 | Method Not Allowed: The request method is not allowed for the requested resource. | | 406 | Not Acceptable: The server cannot produce a response matching the accept headers sent in the request. | | 409 | Conflict: The request could not be processed due to a conflict with the current state of the resource. | | 410 | Gone: The requested resource is no longer available on the server. | | 411 | Length Required: The server requires a Content-Length header field in the request. | | 418 | I'm a Teapot: The server is a teapot and is not able to brew coffee. | | 429 | Too Many Requests: The client has sent too many requests in a given amount of time. |

Server Error Responses (5xx)

| Code | Message | |----------|-----------------------------------------------------------------------------| | 500 | Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request. | | 501 | Not Implemented: The server does not support the functionality required to fulfill the request. | | 502 | Bad Gateway: The server received an invalid response from the upstream server. | | 503 | Service Unavailable: The server is currently unable to handle the request due to maintenance or overload. | | 504 | Gateway Timeout: The server did not receive a timely response from the upstream server. |

Usage Example

NOTE: it will work with any JAVASCRIPT framework

Here’s an example of how to use the reshttp object in an Express.js route:

Conclusion

The reshttp object helps you keep your status codes and messages organized in a consistent, professional format. You can easily expand or modify the messages as needed for your application.

Feel free to use this structure for error handling, success responses, and status codes throughout your project!


Let me know if you need further customization or have additional requests! 😊