# mini-file-server **Repository Path**: fungxu/mini-file-server ## Basic Information - **Project Name**: mini-file-server - **Description**: 这是一个 node.js express写上文件上传服务。最小化。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-02-19 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 接近最小化的node.js上传服务 - 使用的组件: ``` "cors": "^2.8.5", -- 允许跨域调用 "multer": "^1.4.2", -- 上传中间件 "request": "^2.88.2", "request-promise": "^4.2.5" -- 上传后把上传的数据发给后台服务器 ``` - 打开了`express.static` 中间件,这样,上传的文件可以有下载的路径,生产使用时应该使用性能更好的nginx - 注意: 需要准备好`./public/uploads` 目录。 - 上传时使用 form-post , 只接收一个file字段,名字就叫`file`,可以再接收一个`user`字段,这样文件就放在`./public/upload/user/`下了 。 - 服务器可以配到环境变量: `API_URL` 中,例如: `http://localhost:3001/file/save-file-info`