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

mongooseconfig

v1.0.6

Published

an easy mongoose config module

Readme

mongooseconfig

npm version

老婆说“看不过后台php那货写的代码,想自己学学”,于是让我教她mongoose,我才发现原来用了这么久的mongoose,竟然每次都要手写连接,然后再调用,可是手写里面也是有很多坑的,作为一个初学者的她是很难搞定的,于是就有了这个库

Features

  • 无需自己创建连接,用的时候创建配置文件即可
  • 处理了SIGTERM事件,即Node process ends,会自动关闭连接,避免mongodb连接数过多,导致服务器假死
  • 在npm postinstall之后,创建config/mongodb.example.js(如果不存在的话),提示用户修改“cp config/mongodb.example.js config/mongodb.js”
  • 如果不存在config/mongodb.js,这是读取node_modules/mongooseconfig/config/mongodb.js

Install

npm install --save mongooseconfig

Usages

最简单的用法

在app.js(无论是express or koa1 or koa2,还是其他框架)的第一行增加

require('mongooseconfig')()

它会自动创建 config/mongodb.example.js, 你只需复制一份即可

cp config/mongodb.example.js config/mongodb.js

自定义配置路径

在app.js(无论是express or koa1 or koa2,还是其他框架)的第一行增加

require('mongooseconfig')(__dirname + '/myconfig/db.js')

这样它就会加载用户指定的自定义配置路径了

配置项

module.exports = {
  "host": "127.0.0.1",
  "port": "27017",
  "db": "mongoose-config-demo",
  "is_debug":true
};

稍后会加

  • native_parser: true
  • auto_reconnect: true,
  • poolSize: 10
  • is_debug: true

Dev

npm start

Test

npm test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

版本历史

  • v1.0.0 初始化版本

欢迎fork和反馈

如有建议或意见,请在issue提问或邮件

License

this repo is released under the MIT License.