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

tcp-node-config

v1.0.0

Published

nodejs的配置中心

Downloads

1

Readme

node-config

nodejs的配置中心

启动配置中心并存储本地配置,客户端通过连接配置中心获得实时的配置更新。

说明

  1. 启动server,即可启动配置中心以及一个简单的配置管理网站。
  2. 启动client,自动根据参数链接配置中心。本地可以使用一份默认配置,也可以使用远程配置。

示例地址

server

下载

将项目下载本地。可以从github上下载。下载地址

启动

node lib/server.js或者npm run start

也可以使用pm2来启动,项目根目录下提供了一份启动配置。使用pm2 start pm2.json可以启动。

配置

1.打开当前ip加端口3000的网址:127.0.0.1:3000。这个端口是可以自己修改的。 2.添加或者修改配置。 3.已连接的客户端会自动更新最新的配置。

client

启动

客户端需要实例化,传入服务端的地址和创建成功的可执行方法。

const client = new Client({}, function () {
    console.log("已连接")
});

使用

获取对应的配置,自动更新远程数据。如果不存在返回null。

let data = await client.config("def", "a")
    console.log(data)

监听

可以监听数据变化或者服务停止等方法。

//监听数据变化
client.on("data", function (key, data) {
    console.log(key, data)
})
client.on("end", function (key, data) {
    console.log("结束")
})
client.on("error", function (key, data) {
    console.log("错误")
})

可期待的特性

1.多级配置自由获取 2.使用sql、nosql数据库保存信息 3.更完善的权限管理