# web-static-upload **Repository Path**: monoseven/web-static-upload ## Basic Information - **Project Name**: web-static-upload - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-01-10 - **Last Updated**: 2025-07-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 本项目用于快速部署前端静态资源文件到服务器上。 # 使用方式 ## 环境安装 ### 1. node 环境安装 可以使用 nvm 管理 node 环境,或者直接使用官方提供的 node 安装方式进行安装,如已经安装,可跳过此步骤。 ```bash # Download and install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash # Download and install Node.js: nvm install 22 # Verify the Node.js version: node -v # Should print "v22.13.0". nvm current # Should print "v22.13.0". # Verify npm version: npm -v # Should print "10.9.2" ``` ### 2. 全局安装 pm2 ```bash npm install pm2 -g ``` ## 项目配置 ### 1. clone 代码 ```bash git clone https://gitee.com/monoseven/web-static-upload.git ``` ### 2. 修改配置文件 修改 src/config/index.ts 文件,根据实际情况修改配置静态资源目录,并配置一个空闲的端口号用于启动本服务。 ### 3. 调试代码 ```bash npm run dev ``` ### 4. 编译代码 ```bash npm run build ``` ### 5. 启动服务 ```bash # 前台启动 npm run start # 后台启动 npm run serve ``` ## 更新功能开发 ### 1. 更新功能接口 可使用 postman 等工具请求该接口部署前端静态资源文件 或 开发相关前端页面进行部署 **URL:** `/api/static/update` **方法:** `POST` **请求体格式:** `multipart/form-data` **参数:** - `remark`: `string` - 备注信息 - `file`: `File` - 上传的文件, **请注意:** - 压缩文件名称中不能包含字符,仅可使用英文、汉字,且不可有空格; - 压缩包内部的 index.html 要在根目录中,不要在目录下,即压缩包内部不能存在包裹所有文件的文件夹。