dbx 工具服务(nodejs)
npm
和yarn
选其一即可,推荐使用yarn
# 安装依赖
yarn
# 安装pm2
yarn global add pm2
# 安装依赖
npm install
# 安装pm2
npm install -g pm2
# 默认端口3000
yarn run prd
# 指定端口(Mac|Linux)
PORT=10080 yarn run prd
# 指定端口(Windows)
set PORT=10080
yarn run prd
POST: http://ip:port/{method}
{method}
: dbx-chain-tools 工具的方法,参数在请求body中携带
$.ajax({
url: 'http://localhost:3000/encodeMemo',
type: 'POST',
dataType: 'json',
contentType: 'application/json',
data: { pKey, fromKey, toKey, memo },
success: (res) {
// 成功
if (res.code === 200) {
console.log(res.data)
} else {
// 失败
console.error(res.message)
}
}
})