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

connect-uuid

v0.1.2

Published

Connect middleware to assign a UUID to every request.

Downloads

85

Readme

 _______  _______  _        _        _______  _______ _________                      _________ ______  
(  ____ \(  ___  )( (    /|( (    /|(  ____ \(  ____ \\__   __/    |\     /||\     /|\__   __/(  __  \ 
| (    \/| (   ) ||  \  ( ||  \  ( || (    \/| (    \/   ) (       | )   ( || )   ( |   ) (   | (  \  )
| |      | |   | ||   \ | ||   \ | || (__    | |         | | _____ | |   | || |   | |   | |   | |   ) |
| |      | |   | || (\ \) || (\ \) ||  __)   | |         | |(_____)| |   | || |   | |   | |   | |   | |
| |      | |   | || | \   || | \   || (      | |         | |       | |   | || |   | |   | |   | |   ) |
| (____/\| (___) || )  \  || )  \  || (____/\| (____/\   | |       | (___) || (___) |___) (___| (__/  )
(_______/(_______)|/    )_)|/    )_)(_______/(_______/   )_(       (_______)(_______)\_______/(______/ 
                                                                                                       

Connect middleware which assigns a UUID to every request.

Usage

$ npm install connect-uuid

var uuid = require('connect-uuid');
uuid(); // returns middleware which sets req.uuid

In some other code:

logMe(req.uuid, 'Something bad happened');

Motivation

When you have so many requests, it's hard to grep (search, find, etc) the logs to figure out what went wrong when you get a bad request. connect-uuid to the rescue.

Add this module as connect middleware and each request has a UUID. When you log anything, make sure you log this UUID with it. When you get an error in your application, make sure you use the UUID when reporting it (whether that is logged, email or whatever). Also, tell the user (in their 50x page) what the UUID is when something goes wrong, so that they can tell you to sort things out.

By doing all this, you can easily find the request and what really happened to it. You maye keep detailed or slight logs, but either way will really help.

Then you can grep or even select from your logs for that UUID!

For example, when using winston-simpledb, you might be able to select those logs with:

SELECT * FROM logs WHERE uuid = 'xxxxxxxx-xxxx-xxxx--xxxx-xxxxxxxxxxxx';

:)

Author

Written by Andrew Chilton

Copyright 2011 AppsAttic

License

MIT. See LICENSE for more details.