标签归档:node

yapi 安装和使用

使用 npm 安装

npm i -g yapi-cli
yapi server

更新

# 必要时更新 yapi-cli
npm i -g yapi-cli
yapi update

部署

安装 supervisor,添加以下配置,配置中的路径改为实际值:

[program:server-yapi]
;process_name=%(program_name)s_%(process_num)02d
;process_name=%(process_num)02d
command=/bin/node vendors/server/app.js
numprocs=1
directory=/var/lib/yapi
autostart=true
autorestart=true
user=sddt
redirect_stderr=true
stdout_logfile=/var/lib/yapi/log/queue.log

添加反向代理,例:

# apache
<VirtualHost *:90>
        ServerName yapi.dsmcase.com

        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/
</VirtualHost>