senecajs-attic / getting-started

Code examples for the Seneca Getting Started Guide
MIT License
29 stars 17 forks source link

seneca-web examples are out of date #11

Closed tswaters closed 7 years ago

tswaters commented 7 years ago

See:

https://github.com/senecajs/senecajs.org/issues/266

I can send a PR that updates these... stay tuned!

jfinckh commented 7 years ago

I cloned your pull-request and tried it with node math-pin-service.js --seneca.log=plugin:math
node app.js --seneca.log=plugin:web,plugin:api

and in the browser: http://localhost:3000/api/calculate/sum?left=2&right=3 , expecting the answer 5, getting:

{"notice":"seneca: No matching action pattern found for { left: 2, right: 3, role: 'math' }, and no default result provided (using a default$ property).","code":"act_not_found","err":{"eraro":true,"orig":null,"code":"act_not_found","seneca":true,"package":"seneca","msg":"seneca: No matching action pattern found for { left: 2, right: 3, role: 'math' }, and no default result provided (using a default$ property).","details":{"args":"{ left: 2, right: 3, role: 'math' }","plugin":{}},"callpoint":"at handle_inward_break (/home/fingu/node_modules/seneca/seneca.js:1155:23)","name":"Error"},"actid":"dfjw70l3gq8s/zvxnqagh1hd4","msg":{"left":2,"right":3,"role":"math","plugin$":{"name":"api"},"fatal$":true,"meta$":{"id":"8gnln4l4o4i5/8v9vuuuujflu","tx":"8v9vuuuujflu","pattern":"role:math","action":"(nki9himt1g5k)","plugin_name":"client$","plugin_tag":"-","prior":{"chain":[],"entry":true,"depth":0}},"tx$":"8v9vuuuujflu"},"entry":true,"prior":[],"meta":{"plugin_name":"math","plugin_tag":"-","plugin_fullname":"math","raw":{"role":"math"},"sub":false,"client":false,"args":{"role":"math"},"rules":{},"id":"(fec9og3r8y5i)","pattern":"role:math","msgcanon":{"role":"math"},"priormeta":{"plugin_name":"client$","plugin_tag":"-","plugin_fullname":"client$","raw":{"role":"math","client$":true,"internal$":{"catchall":true}},"sub":false,"client":true,"args":{"role":"math"},"rules":{},"id":"(nki9himt1g5k)","pattern":"role:math","msgcanon":{"role":"math"},"priorpath":""},"priorpath":"(nki9himt1g5k);"},"client":false,"listen":false,"transport":{},"kind":"act","case":"ERR","duration":49,"level":"error","plugin_name":"api","pattern":"path:calculate,role:api","when":1479133402821} []

Is this my bad? I'm really a seneca-greenhorn :/

tswaters commented 7 years ago

I wasn't able to get your error - that looks like operation isn't getting provided? I fixed that at some point in one of those commits. They were all force pushed though (that's all the noise above)... If you git show HEAD does the commit hash show 3c735ea or one of the other commits? Either way you should be able to pull now to get the latest. Or maybe delete & re-clone. I really shouldn't squash commits like that with force push :S

I did notice a different issue though after I cloned this on a different machine seneca-web wasn't getting instantiated, which resulted in no routes being populated. (cannot get /api/calculate/sum). I think this might be the result of how 2.0.0 of seneca works maybe? It has a dependency to the pre-1.0 seneca-web so I think it was requiring that package when referenced via string instead of 2.0 which I intended to reference.

Anyway, bringing in seneca-web through a require instead of being passed as a string fixes that.... I've updated the PR for this and senecajs.org.

jfinckh commented 7 years ago

Hrm, amazing, delete and re-clone works, now everything is fine. Sorry for the circumstances and well done! :)