如何将nodejs库集成到我的非nodejs项目中?我特别需要这个库:https://github.com/greenify/biojs-io-blast
发布于 2015-06-26 14:04:19
BioJS使用Browserify CDN自动生成一个供使用的JS文件。要么包括
<script src="http://wzrd.in/bundle/biojs-io-blast@latest"></script>
或者通过这个链接下载JS文件。
我们还提供了一个JS示例这里。
发布于 2016-11-25 20:46:44
是的,您可以使用发布/订阅模式和队列库(如RabbitMQ )来完成这一任务。
在下面的示例中,作者使用每个平台的NodeJS客户机与RabbitMQ脚本进行通信。
https://github.com/osharim/Communicate-Python-with-NodeJS-through-RabbitMQ
从NodeJS发送的代码:
var amqp = require('amqp');
var amqp_hacks = require('./amqp-hacks');
var connection = amqp.createConnection({ host: "localhost", port: 5672 });
connection.on('ready', function(){
connection.publish('task_queue', 'Hello World!');
console.log(" [x] Sent from nodeJS 'Hello World!'");
amqp_hacks.safeEndConnection(connection);
});然后,在python中接收:
#!/usr/bin/env python
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
#our callback
def suscriber(ch,method , properties , body):
print "[Y] received %r " % (body,)
time.sleep( body.count('.') )
print " [x] Done"
ch.basic_ack(delivery_tag = method.delivery_tag)
channel.basic_qos(prefetch_count=1)
channel.basic_consume(suscriber, queue = 'task_queue')
print ' [*] Waiting for messages from Python. To exit press CTRL+C'
channel.start_consuming()发布于 2015-10-03 22:01:38
若要集成任何节点库,请使用包管理器NPM https://www.npmjs.com/,因此要集成库,请执行以下操作
https://stackoverflow.com/questions/31063474
复制相似问题