mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-04-29 09:55:52 +08:00
updated test-app
This commit is contained in:
@@ -78,7 +78,16 @@ Script.prototype.run = function (ctx, domain, fn) {
|
||||
|
||||
domain.dpd = ctx.dpd;
|
||||
|
||||
if(domain) wrapAsyncFunctions(domain, scriptContext, events, done);
|
||||
if(fn) {
|
||||
// if a callback is expected, count callbacks
|
||||
// and manually merge the domain
|
||||
wrapAsyncFunctions(domain, scriptContext, events, done);
|
||||
} else {
|
||||
// otherwise just merge the domain
|
||||
Object.keys(domain).forEach(function (key) {
|
||||
scriptContext[key] = domain[key];
|
||||
})
|
||||
}
|
||||
scriptContext.this = scriptContext._this = domain.data;
|
||||
}
|
||||
|
||||
|
||||
7
test-app/node_modules/proxy/index.js
generated
vendored
7
test-app/node_modules/proxy/index.js
generated
vendored
@@ -6,16 +6,17 @@ var Resource = require('deployd/lib/resource')
|
||||
, util = require('util')
|
||||
, request = require('request');
|
||||
|
||||
function Proxy(settings) {
|
||||
function Proxy(name, options) {
|
||||
Resource.apply(this, arguments);
|
||||
this.remote = settings.remote;
|
||||
this.remote = this.config.remote;
|
||||
}
|
||||
util.inherits(Proxy, Resource);
|
||||
module.exports = Proxy;
|
||||
|
||||
Proxy.prototype.handle = function (ctx, next) {
|
||||
if(ctx.req && ctx.req.method !== 'GET') return next();
|
||||
request.get(this.remote + ctx.url).pipe(ctx.res);
|
||||
var remote = this.remote;
|
||||
request.get(remote + ctx.url).pipe(ctx.res);
|
||||
}
|
||||
|
||||
Proxy.label = 'HTTP Proxy';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"path": "/proxy",
|
||||
"order": 7,
|
||||
"remote": "http://yahoo.com",
|
||||
"remote": "http://www.yahoo.com",
|
||||
"type": "Proxy"
|
||||
}
|
||||
1
test-app/resources/proxy/get.js
Normal file
1
test-app/resources/proxy/get.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log('bar');
|
||||
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"properties": {
|
||||
"message": {
|
||||
"tags": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"typeLabel": "string",
|
||||
"id": "message",
|
||||
"name": "message",
|
||||
"order": 0,
|
||||
"$renameFrom": "messages"
|
||||
"type": "array",
|
||||
"typeLabel": "array",
|
||||
"id": "tags",
|
||||
"name": "tags",
|
||||
"order": 0
|
||||
},
|
||||
"people": {
|
||||
"required": false,
|
||||
@@ -17,38 +16,31 @@
|
||||
"name": "people",
|
||||
"order": 1
|
||||
},
|
||||
"tags": {
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"typeLabel": "array",
|
||||
"id": "tags",
|
||||
"name": "tags",
|
||||
"order": 2
|
||||
},
|
||||
"owner": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"typeLabel": "string",
|
||||
"id": "owner",
|
||||
"name": "owner",
|
||||
"order": 3,
|
||||
"order": 2,
|
||||
"$renameFrom": "ownerssss"
|
||||
},
|
||||
"done": {
|
||||
"required": false,
|
||||
"type": "boolean",
|
||||
"typeLabel": "string",
|
||||
"id": "done",
|
||||
"name": "done",
|
||||
"order": 4
|
||||
},
|
||||
"order": {
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"typeLabel": "string",
|
||||
"id": "order",
|
||||
"name": "order",
|
||||
"order": 5
|
||||
"order": 3
|
||||
},
|
||||
"message": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"typeLabel": "string",
|
||||
"id": "message",
|
||||
"name": "message",
|
||||
"order": 4,
|
||||
"$renameFrom": "messages"
|
||||
},
|
||||
"title": {
|
||||
"required": false,
|
||||
@@ -56,8 +48,16 @@
|
||||
"typeLabel": "string",
|
||||
"id": "title",
|
||||
"name": "title",
|
||||
"order": 6,
|
||||
"order": 5,
|
||||
"$renameFrom": "titlesss"
|
||||
},
|
||||
"done": {
|
||||
"required": false,
|
||||
"type": "boolean",
|
||||
"typeLabel": "string",
|
||||
"id": "done",
|
||||
"name": "done",
|
||||
"order": 6
|
||||
}
|
||||
},
|
||||
"path": "/todos",
|
||||
|
||||
Reference in New Issue
Block a user