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 🙏

© 2024 – Pkg Stats / Ryan Hefner

express-req-res-inspector

v3.0.2

Published

The `express-req-res-inspector` package provides a versatile middleware for Node.js applications built on the Express.js framework. This middleware seamlessly integrates into your project, offering comprehensive logging of incoming requests and outgoing r

Downloads

38

Readme

Express-Req-Res-Inspector

npm version License

Tired of playing detective every time an API call hits a speed bump? Meet your new sidekick – the Express-Req-Res-Inspector! 🕵️‍♂️

This versatile middleware takes care of the heavy lifting when it comes to understanding your API's requests and responses. It's like having Sherlock Holmes on your team

Features

1. Collaborative Debugging:

Ever had a frontend dev claim they sent data in params, body, or queries, or you were positive you sent the data, but they're pulling a classic "the dog ate my homework" move? The Express-Req-Res-Inspector logs every aspect of incoming requests and outgoing responses. This comprehensive log serves as a virtual referee, resolving disputes and harmonizing the teamwork.

2. Response Time Tracking:

Picture it as your app's personal fitness tracker. Keep tabs on response times and effortlessly pinpoint areas that are lifting weights like pros or snoozing on the job. With this valuable insight, you can optimize where it matters and ensure your app stays swift and responsive.

Real-Life Situations

Case #1:

Frontend Dev: "The API's not sending the data!"

You: sips coffee "One moment, please." 🧐

Example Image

The logs reveal the API did send the data, but the frontend ...

Case #2:

Frontend Dev: "The app's as slow as a snail on vacation!"

You: sips coffee "One moment, please." 🧐

Example Image

Your trusty logs highlight an endpoint that's taking its sweet time, and You're the Flash of the backend world! ⚡️

Installation

1. Install using npm:

npm install express-req-res-inspector

2. Integrate the Middleware:

In your Express application's code, import the express-req-res-inspector package and add the middleware to your app using the app.use() method:

const express = require("express");
const app = express();
const reqResInspector = require("express-req-res-inspector");

// Other middleware and routes

// Customize the logging options
app.use(
  reqResInspector({
    requestTime: true, // Log the request Time
    requestUrl: true, // Log the request URL
    requestBody: true, // Log the request body
    responseStatus: true, // Log the response status code
    responseMessage: true, // Log a response message
    responseTime: false, // Log the response time; set to `true` to enable
  })
);

// By customizing the options object, you can control which details are logged. By default, if no options are specified, all properties will be set to true.

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

The reqResInspector() function call adds the middleware to your app, allowing it to log request and response details.

Contribute

We welcome your contributions! Check out our contribution guidelines and let's build the ultimate debugging sidekick together. 🦸‍♂️

License

This project is licensed under the MIT License - see the LICENSE file for details.