All Projects → sikichan → oss-upload-nodejs

sikichan / oss-upload-nodejs

Licence: Apache-2.0 license
服务器签名后直接上传文件到阿里云 OSS

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
HTML
75241 projects

Projects that are alternatives of or similar to oss-upload-nodejs

node-typescript-starter
REST API using Node with typescript, KOA framework. TypeORM for SQL. Middlewares JWT (auth), CORS, Winston Logger, Error, Response
Stars: ✭ 19 (-68.85%)
Mutual labels:  koa
kaonjs
Kaon.js is a react isomorphic app solution. It contains webpack build, hot reloading, code splitting and server side rendering.
Stars: ✭ 21 (-65.57%)
Mutual labels:  koa
koa-cache-lite
Zero-dependency koa router cache
Stars: ✭ 27 (-55.74%)
Mutual labels:  koa
nodejs-api-kickstarter
A batteries included NodeJS API Kickstater focused on extensability and developer productivity.
Stars: ✭ 20 (-67.21%)
Mutual labels:  koa
GithubProfile
Visualizing GitHub profile
Stars: ✭ 45 (-26.23%)
Mutual labels:  koa
Rephic
💼 Rephic 是一个基于 Koa 的 React 服务端渲染工程脚手架。支持 React-Router, Redux 以及 Less, Sass。
Stars: ✭ 23 (-62.3%)
Mutual labels:  koa
guli-mall
尚硅谷-谷粒商城代码及文档https://www.yuque.com/zhangshuaiyin/guli-mall
Stars: ✭ 233 (+281.97%)
Mutual labels:  oss
opsli-ui
OPSLI 快速开发平台基于springboot、vue、element-ui ,项目采用前后端分离架构,热插拔式业务模块与插件扩展性高 ,代码简洁,功能丰富,开箱即用
Stars: ✭ 76 (+24.59%)
Mutual labels:  oss
Getting-Started-With-Contributing-to-Open-Sources
This has useful links to help you get started with contributing to open sources.
Stars: ✭ 44 (-27.87%)
Mutual labels:  oss
campus-leaflets
校园传单是一个使用 Node.js、MongoDB、Koa、EJS、MDL、Less、RequireJS 和 Gulp 开发的 Node 应用程序。
Stars: ✭ 16 (-73.77%)
Mutual labels:  koa
koa2-swagger-ui
Swagger UI as Koa v2 middleware
Stars: ✭ 95 (+55.74%)
Mutual labels:  koa
koa-simple-ratelimit
Simple rate limiter for Koa.js v2 web framework
Stars: ✭ 17 (-72.13%)
Mutual labels:  koa
conjur-quickstart
Start securing your secrets and infrastructure by installing Conjur, using Docker and the official Conjur containers on DockerHub.
Stars: ✭ 18 (-70.49%)
Mutual labels:  oss
blog
✍️无他术,唯勤读书而多为之,自工。
Stars: ✭ 62 (+1.64%)
Mutual labels:  koa
vue-koa-mongodb-oss
一个包含前后端鉴权、验证码生成、阿里云上传图片的前后端技术体系,技术栈vue、koa2、mongodb、oss
Stars: ✭ 82 (+34.43%)
Mutual labels:  oss
objection-authorize
isomorphic, "magical" authorization integration with Objection.js 🎉
Stars: ✭ 71 (+16.39%)
Mutual labels:  koa
oss-rust-sdk
Aliyun OSS SDK for Rust
Stars: ✭ 59 (-3.28%)
Mutual labels:  oss
FireSnapshot
A useful Firebase-Cloud-Firestore Wrapper with Codable.
Stars: ✭ 56 (-8.2%)
Mutual labels:  oss
koa-context-validator
A robust context validator for koajs. Use Joi behind the scenes.
Stars: ✭ 49 (-19.67%)
Mutual labels:  koa
vue-oss
基于vue2+plupload的阿里云OSS上传组件(支持断点续传,可上传size>100M的文件)
Stars: ✭ 33 (-45.9%)
Mutual labels:  oss

oss-upload-nodejs

基于node.js和oss的单文件上传Demo。 如何运行这个Demo?

  • 后端:backend目录
npm install
npm start
  • 前端:webfront目录
npm install
npm run dev

单个图片上传页面,上传后显示图片预览

image

阿里云OSS服务端签名后直传

我们都知道,采用JS客户端直接签名,OSSAccessId和AccessKeySecret暴露在前端页面,可以被轻易获取,存在严重安全隐患。 这里提供了一种使用阿里云OSS服务器端签名后直传,避免这种危险的方法。由于阿里云OSS开发文档只提供了Java,PHP,Python和Go语言的例子,本Demo在此提供一个以Node.js作为后端的例子,供大家参考。


请求逻辑:

  1. 客户端要上传图片时,到应用服务器取上传的policy及签名(signature)
  2. 应用服务器返回上传policy和signature
  3. 客户端拿到了签名后,直接上传到OSS

目前支持

chrome, firefox浏览器,其他浏览器还未全面测试,欢迎大家测试后在Issues里反馈。

使用

配置OSS

  1. 进入阿里云管理控制台 --> 对象存储OSS
  2. 新建Bucket
  3. Bucket属性 --> 跨域设置: image

查看自己的AccessKey

image image 点击显示,会弹出短信验证窗口,验证后即可显示出你的AccessKeySecret

后端配置文件

backend/src/config/development/app.js

module.exports = {
  port: 3602,
  oss: {
    OSSAccessKeyId: '【这里填你阿里云的Access Key ID】',
    secret: '【这里填你阿里云的Access Key Secret】',
    host: 'http://cqq.oss-cn-shenzhen.aliyuncs.com' //改为你自己阿里云OSS的外网域名
  }
}

技术栈

欢迎Start,欢迎Pull Requests

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].