Home avatar

This is my blog

记录一次部署lx-Music-Sync-Server

asdf 安装相应版本 go, node

安装 asdf 之后, 安装 go node

1
2
3
4
5
asdf plugin list all
asdf plugin add node

asdf list all nodejs
asdf install nodejs 16.20.2

编译 lx-music-sync-server 并测试

1
2
3
4
5
6
7
8
git clone https://github.com/lyswhut/lx-music-sync-server.git --depth 1
cd lx-music-sync-server

asdf set nodejs 16.20.2
asdf current

npm ci
npm run build

pm2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
npm i -g pm2

cd ~/Workspace/lx-music-sync-server

pm2 restart lx-music-sync-server  # 重启服务
pm2 logs

# lx-music-sync-server 服务开机启动
pm2 save
pm2 startup

测试

config.js:

Rust 的宏

宏的种类

Rust 的宏系统是其强大功能之一,允许你在编译时生成代码。Rust 有两种主要类型的宏:

  1. 声明式宏(Declarative Macros) - 使用 macro_rules! 语法
  2. 过程宏(Procedural Macros) - 更强大也更复杂,分为三种:
    • 自定义派生(#[derive] 宏)
    • 属性式宏
    • 函数式宏

声明式宏

使用 macro_rules! 定义。