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

express-comment

v0.1.2

Published

Express simple article post/comment/response system middleware

Readme

express-comment Simple Article Post/Comment Management Middleware

express-comment is a middleware bundled with frontend API utilities that allows you to create a simple yet highly usable post/comment system with minimal code.

Condition

This package is under active development, and is just entering its alpha stage. The API may change with new features added in the future.

How to use

Install express-comment-frontend as frontend API and /lib/api.md for details, and /example/* for examples of backend use. In general, you can simply mount the middleware on a path with minimal configuration, and use /lib/frontend predefined API for simple query and update.

Demo

Front-end API

// frontend code, using lib/index.js of express-comment-frontend
let comment = commentFactory(window, '/api/express-comment/mounted/path');

// If you use React/Node instead, you can likely to be able to simply (not yet tested)
import commentFactory from 'express-comment-frontend';
let comment = commentFactory(window, '/api/express-comment/mounted/path');

// begin:

let commentID;
let replyID;

// Callback styled
comment
  .comment('Hello world')
  .by('Kevin')
  .on('Article-01')
  .fire((err, id) => {
    if (err) throw err;
    commentID = id;
  });

// Promise styled
comment
  .reply('This is a reply!')
  .by('Tom')
  .to(commentID)
  .fire()
  .then((id) => replyID = id)
  .catch((err) => console.log('ERROR!', err));

comment
  .update('I want this as reply body instead!')
  .of(replyID)
  .fire();

comment
  .findAll(true) // true if you want to get all replies to the comment found, will be accessible at entry[i].reply
  .of(commentID)
  .fire()
  .then(console.log);

// find root comments on an article
comment
  .findRootAll() // true if you want to get all replies to the comment found, will be accessible at entry[i].reply
  .on('Article-01')
  .fire()
  .then(console.log);

// Delete!
comment
  .delete()
  .by('Tom')
  .fire()
  .then(() => console.log('Sadly, Tom\'s replies are deleted...'))
  .catch((err) => console.log('ERROR!', err));

comment
  .delete()
  .of(commentID)
  .fire()
  .then(() => console.log('Sadly, Kevin\'s first comment is deleted...'))
  .catch((err) => console.log('ERROR!', err));

Back-end API

const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const comment = require('express-comment');
const drivers = comment.drivers;

// General settings
const ecSettings = {}

// with MongoDB (Mongo Native Client)
const mongo_config = {
  /* ... */
  // see /lib/db/mongo/README.md
};
app.use('/api/express-comment/mounted/path', bodyParser.urlencoded({ extended: true }), comment(drivers.mongo(mongo_config), ecSettings));

// or if with Sequelize.js (supporting MySQL, PostgreSQL, SQLite, etc.)
const sequelize_config = {
  database: 'ec',
  username: 'root',
  password: '',
  settings: {
    /* Sequelize config settings, check Sequelize docs about config settings. */
    host: 'localhost',
    dialect: 'mysql',

    pool: {
      max: 5,
      min: 0,
      acquire: 30000,
      idle: 10000
    },
  }
}
app.use('/path/middleware/mounted', bodyParser.urlencoded({ extended: true }), comment(drivers.sql(sequelize_config), ecSettings));

/* ... */

// You are good to go!