我不能EXCUTE一个塞内卡快递URL测试

我的背景是下一个:我不能EXCUTE一个塞内卡快递URL测试

我有3个实例: 1公/角2前端的精简版,服务器端口上运行: 3001加载网页3002是精简版服务器 2 - 公共/塞内卡为客户comunicate服务器是在3003 3-服务器/ MongoDB的与塞内卡的配置是在端口3000

我尽量只执行一个测试,并返回一个文本,但我只是超时。

这是我的文件:

之前,我在角添加逻辑我试图让塞内卡客户端通过浏览器把这个: http://localhost:3003/api/test

我得到一个404没有发现在broser这:不能在塞尼卡客户端GET/API /测试

我有这样的:

var Seneca = require("seneca");  

var Express = require("express");

var Web = require("seneca-web");

var senecaProvince = require("seneca")().client({

host: "127.0.0.1", //"192.168.0.2",

port: 3000 //8080

});

function senecaProvinceApi(options) {

var seneca = this;

/**

* test

*/

seneca.add({

role: "web",

area: "ui",

action: "test"

}, function(args, done) {

senecaProvince.act({

area: "province",

action: "test"

}, function(err, result) {

done(err, result);

});

});

/**

* Gets the full list of provinces

*/

seneca.add({

area: "ui",

action: "provinces"

}, function(args, done) {

senecaProvince.act({

area: "province",

action: "fetch"

}, function(err, result) {

done(err, result);

});

});

/**

* Get a product by id.

*/

seneca.add({

area: "ui",

action: "provincebyid"

}, function(args, done) {

senecaProvince.act({

area: "province",

action: "fetch",

criteria: "byId",

id: args.id

}, function(err, result) {

done(err, result);

});

});

}

var config = {

Routes: [{

prefix: '/api',

pin: {

area: 'ui',

action: '*'

},

map: {

test: {

GET: true

},

province: {

GET: true

},

provincebyid: {

GET: true,

suffix: '/:id'

}

}

}],

adapter: require('seneca-web-adapter-express'),

context: Express()

};

var seneca = Seneca()

.use(senecaProvinceApi)

.use(Web, config)

.ready(() => {

var clientSeneca = seneca.export('web/context')()

seneca.act('role:web,area:ui,action:test', console.log);

clientSeneca.listen('3003',() => {

console.log('server started on: 3003')

})

})

当我运行这段代码与节点scriptName.js

执行好,但对于塞内卡行为,我收到了超时:

server started on: 3003  

["client","invalid_origin",{"host":"127.0.0.1","port":3000,"pg":"","type":"web",

"id":"host:127.0.0.1,pg:,port:3000","role":"transport","hook":"client","plugin$"

:{"name":"client$"},"fatal$":true,"meta$":{"id":"7exetnw7bpf7/pdf1qyqak0a7","tx"

:"pdf1qyqak0a7","pattern":"hook:client,role:transport,type:web","action":"(9xy5c

9gfhsxq)","plugin_name":"transport","plugin_tag":"-","prior":{"chain":[],"entry"

:true,"depth":0},"start":1480200582782,"sync":true},"tx$":"pdf1qyqak0a7","path":

"/act","protocol":"http","timeout":5555,"max_listen_attempts":11,"attempt_delay"

:222,"serverOptions":{}},{"kind":"res","res":{"type":"Buffer","data":[67,97,110,

110,111,116,32,80,79,83,84,32,47,97,99,116,10]},"error":{"type":"Buffer","data":

[67,97,110,110,111,116,32,80,79,83,84,32,47,97,99,116,10]},"sync":true,"time":{"

client_recv":1480200582830}}]

{"notice":"seneca: Action action:test,area:ui,role:web failed: [TIMEOUT].","code

":"act_execute","err":{"eraro":true,"orig":{},"code":"act_execute","seneca":true

,"package":"seneca","msg":"seneca: Action action:test,area:ui,role:web failed: [

TIMEOUT].","details":{"message":"[TIMEOUT]","pattern":"action:test,area:ui,role:

web","instance":"Seneca/zdo3fusqyffz/1480200582728/13348/3.2.2/-","orig$":{},"me

ssage$":"[TIMEOUT]","plugin":{}},"callpoint":"at Object.act_tm [as ontm] (C:\\De

vProjects\\ThinkUpVacations\\public\\node_modules\\seneca\\seneca.js:1024:46)"},

"actid":"l15ybf5u5956/6g5ugs5h8r1b","msg":{"role":"web","area":"ui","action":"te

st","meta$":{"id":"l15ybf5u5956/6g5ugs5h8r1b","tx":"6g5ugs5h8r1b","pattern":"act

ion:test,area:ui,role:web","action":"(vq1mjuzautzr)","plugin_name":"senecaProvin

ceApi","plugin_tag":"-","prior":{"chain":[],"entry":true,"depth":0},"start":1480

200582794,"sync":true},"plugin$":{"name":"senecaProvinceApi","tag":"-"},"tx$":"6

g5ugs5h8r1b"},"entry":true,"prior":[],"meta":{"plugin_name":"senecaProvinceApi",

"plugin_tag":"-","plugin_fullname":"senecaProvinceApi","raw":{"role":"web","area

":"ui","action":"test"},"sub":false,"client":false,"args":{"role":"web","area":"

ui","action":"test"},"rules":{},"id":"(vq1mjuzautzr)","pattern":"action:test,are

a:ui,role:web","msgcanon":{"action":"test","area":"ui","role":"web"},"priorpath"

:""},"client":false,"listen":false,"transport":{},"kind":"act","case":"ERR","dur

ation":22290,"level":"error","when":1480200605089}

{ Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\node_modu

les\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacations\pu

blic\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5)

eraro: true,

orig:

Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\node_m

odules\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacations

\public\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5),

code: 'act_execute',

seneca: true,

package: 'seneca',

msg: 'seneca: Action action:test,area:ui,role:web failed: [TIMEOUT].',

details:

{ message: '[TIMEOUT]',

pattern: 'action:test,area:ui,role:web',

fn: [Function],

cb: [Function: bound ],

instance: 'Seneca/zdo3fusqyffz/1480200582728/13348/3.2.2/-',

'orig$':

Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\nod

e_modules\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacati

ons\public\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5),

'message$': '[TIMEOUT]',

plugin: {} },

callpoint: 'at Object.act_tm [as ontm] (C:\\DevProjects\\ThinkUpVacations\\pub

lic\\node_modules\\seneca\\seneca.js:1024:46)' }

{"notice":"seneca: Action failed: [TIMEOUT].","code":"act_execute","err":{"erar

o":true,"orig":{},"code":"act_execute","seneca":true,"package":"seneca","msg":"s

eneca: Action failed: [TIMEOUT].","details":{"message":"[TIMEOUT]","pattern":""

,"instance":"Seneca/gags37ukcd3c/1480200582435/13348/3.2.2/-","orig$":{},"messag

e$":"[TIMEOUT]","plugin":{}},"callpoint":"at Object.act_tm [as ontm] (C:\\DevPro

jects\\ThinkUpVacations\\public\\node_modules\\seneca\\seneca.js:1024:46)"},"act

id":"244bca4nlvw8/5h4dtyfolw1g","msg":{"area":"province","action":"test","meta$"

:{"id":"244bca4nlvw8/5h4dtyfolw1g","tx":"5h4dtyfolw1g","pattern":"","action":"(3

7e0fxenvdtu)","plugin_name":"client$","plugin_tag":"-","prior":{"chain":[],"entr

y":true,"depth":0},"start":1480200582804,"sync":true},"plugin$":{"name":"client$

","tag":"-"},"tx$":"5h4dtyfolw1g"},"entry":true,"prior":[],"meta":{"plugin_name"

:"client$","plugin_tag":"-","plugin_fullname":"client$","raw":{"client$":true,"i

nternal$":{"catchall":true}},"sub":false,"client":true,"args":{},"rules":{},"id"

:"(37e0fxenvdtu)","pattern":"","msgcanon":{},"priorpath":""},"client":true,"list

en":false,"transport":{},"kind":"act","case":"ERR","duration":22290,"level":"err

or","when":1480200605095}

{"notice":"seneca: Action failed: [TIMEOUT].","code":"act_execute","err":{"erar

o":true,"orig":{},"code":"act_execute","seneca":true,"package":"seneca","msg":"s

eneca: Action failed: [TIMEOUT].","details":{"message":"[TIMEOUT]","pattern":""

,"instance":"Seneca/gags37ukcd3c/1480200582435/13348/3.2.2/-","orig$":{},"messag

e$":"[TIMEOUT]","plugin":{}},"callpoint":"at Object.act_tm [as ontm] (C:\\DevPro

jects\\ThinkUpVacations\\public\\node_modules\\seneca\\seneca.js:1024:46)"},"act

id":"l15ybf5u5956/6g5ugs5h8r1b","msg":{"role":"web","area":"ui","action":"test",

"meta$":{"id":"l15ybf5u5956/6g5ugs5h8r1b","tx":"6g5ugs5h8r1b","pattern":"action:

test,area:ui,role:web","action":"(vq1mjuzautzr)","plugin_name":"senecaProvinceAp

i","plugin_tag":"-","prior":{"chain":[],"entry":true,"depth":0},"start":14802005

82794,"sync":true},"plugin$":{"name":"senecaProvinceApi","tag":"-"},"tx$":"6g5ug

s5h8r1b"},"entry":true,"prior":[],"meta":{"plugin_name":"senecaProvinceApi","plu

gin_tag":"-","plugin_fullname":"senecaProvinceApi","raw":{"role":"web","area":"u

i","action":"test"},"sub":false,"client":false,"args":{"role":"web","area":"ui",

"action":"test"},"rules":{},"id":"(vq1mjuzautzr)","pattern":"action:test,area:ui

,role:web","msgcanon":{"action":"test","area":"ui","role":"web"},"priorpath":""}

,"client":false,"listen":false,"transport":{},"kind":"act","case":"ERR","duratio

n":22302,"level":"error","when":1480200605096}

{ Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\node_modu

les\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacations\pu

blic\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5)

eraro: true,

orig:

Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\node_m

odules\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacations

\public\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5),

code: 'act_execute',

seneca: true,

package: 'seneca',

msg: 'seneca: Action failed: [TIMEOUT].',

details:

{ message: '[TIMEOUT]',

pattern: '',

fn: { [Function: transport_client] id: 'host:127.0.0.1,pg:,port:3000' },

cb: [Function],

instance: 'Seneca/gags37ukcd3c/1480200582435/13348/3.2.2/-',

'orig$':

Error: [TIMEOUT]

at Object.act_tm [as ontm] (C:\DevProjects\ThinkUpVacations\public\nod

e_modules\seneca\seneca.js:1024:46)

at Timeout.timeout_check [as _onTimeout] (C:\DevProjects\ThinkUpVacati

ons\public\node_modules\gate-executor\gate-executor.js:216:16)

at ontimeout (timers.js:365:14)

at tryOnTimeout (timers.js:237:5)

at Timer.listOnTimeout (timers.js:207:5),

'message$': '[TIMEOUT]',

plugin: {} },

callpoint: 'at Object.act_tm [as ontm] (C:\\DevProjects\\ThinkUpVacations\\pub

lic\\node_modules\\seneca\\seneca.js:1024:46)' } undefined

,并在服务器,我有这样的:

var Seneca = require("seneca");  

var Web = require("seneca-web");

var Express = require('express');

var Routes = require('./routes');

var provincePlugin = require('./provincePlugin');

/*

seneca.use('mongo-store', {

name: 'DoMyTrip-TouristZone',

host: '127.0.0.1',

port: 27017,

options: {}

})

*/

var config = {

Routes: Routes,

adapter: require('seneca-web-adapter-express'),

context: Express()

};

var seneca = Seneca()

.use(provincePlugin)

.use(Web, config)

.ready(() => {

//express.use(require("body-parser").json());

var server = seneca.export('web/context')()

server.listen('3000',() => {

console.log('server started on: 3000')

})

//seneca.act('role:web,area:province,action:test', console.log);

})

"use strict";  

module.exports = function provincePlugin(options) {

var seneca = this;

seneca.add({

role: "web",

area: "province",

action: "test"

}, function(req, done) {

done(null, {

result: "Hello World From Seneca"

});

});

seneca.add({

area: "province",

action: "fetch"

}, function(args, done) {

var provinces = this.make("provinces");

provinces.list$({}, done);

});

seneca.add({

area: "province",

action: "fetch",

criteria: "byId"

}, function(args, done) {

var province = this.make("provinces");

province.load$(args.id, done);

});

}

'use strict'  

module.exports = [{

prefix: '/provinces',

pin: {

area: 'province',

action: '*'

},

map: {

fetch: {

GET: true

},

test: {

GET: true

}

}

}]

> [email protected] start C:\DevProjects\ThinkUpVacations\server\province  

> node app/index.js

{"kind":"notice","notice":"hello seneca w1eo77330jgi/1480188397177/4280/3.2.2/-","level":"info","when":1480188397212}

(node:4280) DeprecationWarning: 'root' is deprecated, use 'global'

server started on: 3000

我希望能帮帮我! !

迎接!

回答:

我离开的人解决其他需要的方向:

首先改变与路由的配置较低的情况下,你怎么说的开始:

var config = {  

routes: Routes,

context: Express(),

adapter: require('seneca-web-adapter-express')

};

,需要改变在这样的路线销:

pin: 'role:web,area:province,action:*',

这项工作,:d

以上是 我不能EXCUTE一个塞内卡快递URL测试 的全部内容, 来源链接: utcz.com/qa/259182.html

回到顶部