Nacos引擎NodeJS接入文档 API使用 服务注册 注册实例 registerInstance(serviceName, instance, [groupName]) Register an instance to service. serviceName {String} Service name instance {Instance} ip {String} IP of instance port {Number} Port of instance [weight] {Number} weight of the instance, default is 1.0 [ephemeral] {Boolean} active until the client is alive, default is true [clusterName] {String} Virtual cluster name [groupName] {String} group name, default is DEFAULTGROUP 注销实例 deregisterInstance(serviceName, ip, port, [groupName]) Delete instance from service. serviceName {String} Service name instance {Instance} ip {String} IP of instance port {Number} Port of instance [weight] {Number} weight of the instance, default is 1.0 [ephemeral] {Boolean} active until the client is alive, default is true [clusterName] {String} Virtual cluster name [groupName] {String} group name, default is DEFAULTGROUP 查询实例服务 getAllInstances(serviceName, [groupName], [clusters], [subscribe]) Query instance list of service. serviceName {String} Service name [groupName] {String} group name, default is DEFAULTGROUP [clusters] {String} Cluster names [subscribe] {Boolean} whether subscribe the service, default is true 查询服务状态 getServerStatus() Get the status of nacos server, 'UP' or 'DOWN'. 订阅服务 subscribe(info, listener) Subscribe the instances of the service info {Object}{String} service info, if type is string, it's the serviceName listener {Function} the listener function 取消订阅服务 unSubscribe(info, [listener]) Unsubscribe the instances of the service info {Object}{String} service info, if type is string, it's the serviceName listener {Function} the listener function, if not provide, will unSubscribe all listeners under this service