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

dingyou-auth-server

v0.5.0

Published

This is a jsapi authentication server for dingtalk

Downloads

3

Readme

dingyou-auth-server

这是 dingtalk jsapi 的鉴权服务demo

如何使用?

设置环境(centos 7)

vi /etc/environment

选取下面的其一,新增到文件中

NODE_ENV="develop"

NODE_ENV="test"

安装依赖

su root
mkdir -pv /appServer/ && cd /appServer/
git clone /home/git/gitea-repositories/dingyou/ddapiserver.git

su git
cd ddapiserver
npm install 

chown  -R git:git /appServer/ddapiserver && chmod  -R g+rws /appServer/ddapiserver  

增加守护(如果没有安装)

sudo npm install forever -g
ln -s /opt/node-v6.9.2-linux-x64/bin/cnpm /usr/local/bin/cnpm

开机启动

  1. 创建文件: vi /lib/systemd/system/node-ddapiserver.service
[Unit]
Description=node-ddapiserver
After=network.target
After=syslog.target

[Service]
EnvironmentFile=/appServer/ddapiserver/config/env
Type=forking
ExecStart=/usr/local/bin/forever -a start -l /appServer/ddapiserver/forever.log /appServer/ddapiserver/start.js
ExecReload=/usr/local/bin/forever restart /appServer/ddapiserver/start.js
ExecStop=/usr/local/bin/forever stop /appServer/ddapiserver/start.js
PrivateTmp=true

[Install]
WantedBy=multi-user.target
  1. 设置权限:
chmod 754 /lib/systemd/system/node-ddapiserver.service
systemctl enable node-ddApiServer
systemctl start node-ddApiServer
  1. 管理使用
systemctl enable node-ddapiserver => 启用开机启动

systemctl disable node-ddapiserver => 禁止开机启动

systemctl status node-ddapiserver => 检查服务状态

systemctl start node-ddapiserver => 开始服务

systemctl stop node-ddapiserver => 停止服务

systemctl restart node-ddapiserver => 重启服务

Git同步

1. 创建钩子文件
su git
sudo vi /home/git/gitea-repositories/dingyou/ddapiserver.git/hook/post-receive

APP_DIR='/appServer/ddapiserver' export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

cd $APP_DIR env -i git reset --hard env -i git pull

systemctl restart node-ddapiserver

2. 授予权限
sudo chmod +x post-receive
3. 测试同步
# 修改 package.json版本号,提交后,用如下命令观察是否同步成功?测试是否可以正常提供服务?

cat /appServer/ddapiserver/package.json
node start.js

Restful Api 接口说明

/api/token

1. request(请求方式)
2. 

2. response(返回方式) 

/api/sign

1. request(请求方式)
fetch( 
    "URL",                
    {
        method:"post", 
        headers: { 
            'Accept': 'application/json', 
            'Content-Type': 'application/json', 
        },        
        body:JSON.stringify("字符串")
    }
);
2. response(返回方式) 

附录

  1. 服务器部署: http://gitea.gbtong.com/dingYou/dj.project/wiki/%E9%83%A8%E7%BD%B2-%E6%9C%8D%E5%8A%A1%3A-Node.js
  2. koa参考文档: http://www.liaoxuefeng.com/wiki/001434446689867b27157e896e74d51a89c25cc8b43bdb3000
  3. log4 参考文档: http://www.jianshu.com/p/6b816c609669 https://github.com/tough1985/hello-koa2 http://blog.fens.me/nodejs-log4js/
  4. dingtalk服务端开发文档:https://open-doc.dingtalk.com/doc2/detail?spm=0.0.0.0.vxzHen&treeId=172&articleId=104981&docType=1