Git Product home page Git Product logo

binary-server's Introduction

binary-server

二进制文件服务器 (辅助组件二进制化)

环境配置

  • 安装 node
  • 安装 MongoDB
  • 启动 MongoDB
    • brew services start mongodb

运行

  • npm install
  • npm start

路由

.get('/frameworks', frameworks.show)
.get('/frameworks/:names', frameworks.show)
.get('/frameworks/:name/:version', frameworks.show)
.del('/frameworks/:name/:version', frameworks.destroy)
.get('/frameworks/:name/:version/zip', frameworks.download)
.post('/frameworks', frameworks.create)

以下说明以 http://localhost:8080 为服务器地址,操作 PodA 组件。

获取组件信息:

curl http://localhost:8080/frameworks/PodA
> {"PodA":["0.2.4"]}

curl http://localhost:8080/frameworks
> {"TDFCoreProtocol":["1.2.4","1.2.5"],"PodA":["0.2.4-binary","0.2.4"]}

推送组件 zip 包:

curl http://localhost:8080/frameworks -F "name=PodA" -F "version=0.2.4" -F
  "annotate=Mergebranch'release/0.2.3'into'master'" -F
  "file=@/Users/songruiwang/Work/TDF/cocoapods-tdfire-binary/example/PodA/PodA.framework.zip"
  -F "sha=7bf2c8f3ce1184580abfea7129d1648e499d080e"
> 保存成功 PodA (0.2.4)

zip 包存储在 server 根目录的 .binary 目录下

获取组件 zip 包:

curl http://localhost:8080/frameworks/PodA/0.2.4/zip > PodA.framework.zip

删除组件:

curl -X 'DELETE' http://localhost:8080/frameworks/PodA/0.2.4 -O -J

binary-server's People

Contributors

chenxgen avatar euanchan avatar triplecc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

binary-server's Issues

服务器连接数据库错误

app.js 里面修改了主机地址
const Koa = require('koa')
const router = require('./server/routes')
const logger = require('koa-logger')
const mongoose = require('mongoose')
const koaBody = require('koa-body')

const app = new Koa

mongoose.connect('mongodb://10.10.10.13/binary_database')

app.use(koaBody({ multipart: true }))
app.use(logger())
app.use(router.routes())
app.listen(8080)

执行 弄的app.js时报错如下:

(node:61058) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [10.10.10.13:27017] on first connect [MongoNetworkError: connection 0 to 10.10.10.13:27017 timed out
at Socket. (/Users/zhaopin/binary-server/node_modules/mongodb-core/lib/connection/connection.js:258:7)
at Object.onceWrapper (events.js:421:28)
at Socket.emit (events.js:315:20)
at Socket._onTimeout (net.js:480:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)]
at Pool. (/Users/zhaopin/binary-server/node_modules/mongodb-core/lib/topologies/server.js:505:11)
at Pool.emit (events.js:315:20)
at Connection. (/Users/zhaopin/binary-server/node_modules/mongodb-core/lib/connection/pool.js:329:12)
at Object.onceWrapper (events.js:422:26)
at Connection.emit (events.js:315:20)
at Socket. (/Users/zhaopin/binary-server/node_modules/mongodb-core/lib/connection/connection.js:256:10)
at Object.onceWrapper (events.js:421:28)
at Socket.emit (events.js:315:20)
at Socket._onTimeout (net.js:480:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(Use node --trace-warnings ... to show where the warning was created)
(node:61058) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:61058) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

二进制上传报错

终端输入:curl http://localhost:8881/frameworks -F "name=BundleImageCache" -F "version=2.0.6" -F "file=BundleImageCache.framework.zip"

服务器报错如下:
TypeError: Cannot read property 'name' of undefined
at create (/Users/yangxinlin/cocoapods-bin-example/binary-server/server/controllers/frameworks.js:64:48)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async logger (/Users/yangxinlin/cocoapods-bin-example/binary-server/node_modules/koa-logger/index.js:67:7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.