## vite打包:会自动编译,生成dist文件夹
vite build
或
npm build## thinkjs配置: src/config/router.js
module.exports = [
[/^\/api\/(.*)/, '/:1']
];## nginx配置
server {
listen 80;
server_name netperf.examples.com;
root /opt/network-performance-monitoring/dist; # 对应vite打包
location /api {
proxy_pass http://localhost:8360/api; # 对应thinkjs
}
}-----
在vue前端访问后端时直接使用ThinkJS的API:/api/...
fetch.get('/api/getdata').then( res => {
...
}); | 留言与评论(共有 0 条评论) “” |