Feathersjs VS Senecajs

我一直在玩塞内加微服务和feathersjs。 两者都有一些相似之处。 我尝试了塞内卡和羽毛的例子。 羽毛几乎没有优势

  • 简单而漂亮的CLI生成器
  • 很好的文档。

缺点是它与Express相结合。 它应该像塞内卡一样独立。

下面是使用Seneca的简单例子的代码。 它运行在不同的端口,似乎所有的服务是相互独立的。 塞内卡更像独立。 我还在git Ramanujan上find了一个惊人的存储库。

我想知道两者的优缺点。 比较两者是非常糟糕的,但我的目标是使用其中之一来制作API。

所以我很困惑select哪一个。

server.js

seneca.add({cmd: 'config'}, function (msg, done) { var config = {rate: 0.23} var value = config[msg.prop] done(null, {value: value}) }) // local rates seneca.add({cmd: 'salestax', country: 'US'}, function (msg, done) { var state = { 'NY': 0.04, 'CA': 0.0625 // ... } var rate = state[msg.state] var total = msg.net * (1 + rate) done(null, {total: total}) }) .listen({"type": "http", "port": 10101}); // categories seneca.add({ cmd: 'salestax', country: 'IE' }, function (msg, done) { var category = { 'top': 0.23, 'reduced': 0.135 // ... } var rate = category[msg.category] var total = msg.net * (1 + rate) done(null, { total: total }) }) .listen({"type": "http", "port": 10102}); //normal seneca.add({cmd: 'salestax'}, function (msg, done) { seneca.act({cmd: 'config', prop: 'rate'}, function (err, result) { var rate = parseFloat(result.value) var total = msg.net * (1 + rate) done(null, {total: total}) }) }) .listen({"type": "http", "port": 10103}); 

client.js

 require('seneca')() .client( {port: 10101} ) .client( {port: 10102} ) .client( {port: 10103} ) .ready( function () { this.act('cmd:salestax,net:100,country:IE,category:reduced', function (err, result) { console.log('IE: ' + result.total) }) this.act('cmd:salestax,net:100,country:US,state:NY', function (err, result) { console.log('US,NY: ' + result.total) }) this.act('cmd:salestax,net:100,country:DE', function (err, result) { console.log('DE: ' + result.total) }) this.act('cmd:salestax,net:100', function (err, result) { console.log(result.total) }) }) 

Interesting Posts