Nodejs实现微服务(对接阿里云对象存储)

Nodejs实现微服务

文件的上传有很多种实现方式,今天呢有我给大家带来我自己用nodejs写的一个demo。

GIT地址: 欢迎Star

接口列表

文件-api文件微服务

用于处理文件上传下载到服务器的功能

构建设置

# 下载 dependencies
npm install

# 启动项目(本地版)
npm run start
# 启动项目(阿里云OSS版)
npm run oss

配置

nodeapifiles-apiconfigdev.yml用于设置系统配置

接口配置

文件上传接口

FILE-SYSTEM
│  .eslintrc.js 
│  .gitignore
│  Dockerfile  //  Docker 配置文件
│  README.md
│  app.js  // 程序主入口
│  ossApp.js
│  package-lock.json
│  package.json
│  test.js
│  yarn.lock
│  文件上传微服务接口.postman_collection.json // 接口位置
│
├─config // 配置层
│      configUtil.js
│      dev.yml
│      msg.yml
│      ossUtil.js
│
├─controller // controller 层
│      ossController.js
│      router.js
│
└─models  // models 层
        file.js
        ossFile.js

源文件

经验分享 程序员 微信小程序 职场和发展