@nestjs/microservices
Advanced tools
Comparing version 2.0.5 to 2.0.6
{ | ||
"name": "@nestjs/microservices", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@microservices)", | ||
@@ -5,0 +5,0 @@ "author": "Kamil Mysliwiec", |
@@ -10,2 +10,5 @@ [![Nest Logo](http://kamilmysliwiec.com/public/nest-logo.png)](http://kamilmysliwiec.com/) | ||
[![Coverage Status](https://coveralls.io/repos/github/kamilmysliwiec/nest/badge.svg?branch=master)](https://coveralls.io/github/kamilmysliwiec/nest?branch=master) | ||
[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer) | ||
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor) | ||
[![Gitter](https://badges.gitter.im/nestjs/nestjs.svg)](https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) | ||
@@ -30,3 +33,3 @@ ## Description | ||
```bash | ||
$ npm i --save @nestjs/core @nestjs/common @nestjs/microservices @nestjs/websockets @nestjs/testing reflect-metadata rxjs redis | ||
$ npm i --save @nestjs/core @nestjs/common @nestjs/microservices @nestjs/websockets @nestjs/testing reflect-metadata rxjs | ||
``` | ||
@@ -48,3 +51,3 @@ | ||
- Supremely useful Dependency Injection, built-in **Inversion of Control** container | ||
- **Hierarchical injector** - increase abstraction in your application by creating reusable modules with type injection | ||
- **Hierarchical injector** - increase abstraction in your application by creating reusable, loosely coupled modules with type injection | ||
- Own modularity system (split your system into reusable modules) | ||
@@ -58,3 +61,3 @@ - **WebSockets** module (based on [socket.io](https://github.com/socketio/socket.io)) | ||
[Documentation & Tutorial](https://kamilmysliwiec.gitbooks.io/nest/content/) | ||
[Documentation & Tutorial](http://docs.nestjs.com) | ||
@@ -66,11 +69,8 @@ ## Starter repos | ||
## Modules | ||
## Useful references | ||
- [CQRS - Event-Driven Architecture](https://github.com/kamilmysliwiec/nest-cqrs) | ||
- [Modules](http://docs.nestjs.com/modules.html) | ||
- [Examples](http://docs.nestjs.com/examples.html) | ||
- [API Reference](http://docs.nestjs.com/api-reference.html) | ||
## Examples | ||
- [Auth0](https://github.com/cdiaz/nestjs-auth0.git) by [@cdiaz](https://github.com/cdiaz) | ||
- [TypeORM](https://github.com/zachgrayio/nest-typeorm-example) by [@zachgrayio](https://github.com/zachgrayio/) | ||
## People | ||
@@ -81,2 +81,37 @@ | ||
## Backers | ||
I am on a mission to provide an architecture to create truly flexible, scalable and loosely coupled systems using Node.js platform. It takes a lot of time, so if you want to support me, let's [become a backer / sponsor]((https://opencollective.com/nest#backer)). I'll appreciate each help. Thanks! | ||
<a href="https://opencollective.com/nest/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a> | ||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a> | ||
## License | ||
@@ -87,5 +122,5 @@ | ||
[npm-image]: https://badge.fury.io/js/%40nestjs%2Fcore.svg | ||
[npm-url]: https://www.npmjs.com/~nestjs | ||
[npm-url]: https://www.npmjs.com/~nestjscore | ||
[downloads-image]: https://img.shields.io/npm/dm/nest.js.svg | ||
[downloads-url]: https://www.npmjs.com/~nestjs | ||
[downloads-url]: https://www.npmjs.com/~nestjscore | ||
[travis-image]: https://api.travis-ci.org/kamilmysliwiec/nest.svg?branch=master | ||
@@ -92,0 +127,0 @@ [travis-url]: https://travis-ci.org/kamilmysliwiec/nest |
@@ -6,5 +6,7 @@ import * as redis from 'redis'; | ||
private readonly url; | ||
private readonly DEFAULT_URL; | ||
private sub; | ||
private pub; | ||
constructor(config: MicroserviceConfiguration); | ||
listen(callback?: () => void): void; | ||
close(): void; | ||
createRedisClient(): redis.RedisClient; | ||
@@ -11,0 +13,0 @@ handleConnection(callback: any, sub: any, pub: any): void; |
@@ -6,13 +6,19 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
const DEFAULT_URL = 'redis://localhost:6379'; | ||
class ServerRedis extends server_1.Server { | ||
constructor(config) { | ||
super(); | ||
this.DEFAULT_URL = 'redis://localhost:6379'; | ||
this.url = config.url || this.DEFAULT_URL; | ||
this.sub = null; | ||
this.pub = null; | ||
this.url = config.url || DEFAULT_URL; | ||
} | ||
listen(callback) { | ||
const sub = this.createRedisClient(); | ||
const pub = this.createRedisClient(); | ||
sub.on('connect', () => this.handleConnection(callback, sub, pub)); | ||
this.sub = this.createRedisClient(); | ||
this.pub = this.createRedisClient(); | ||
this.sub.on('connect', () => this.handleConnection(callback, this.sub, this.pub)); | ||
} | ||
close() { | ||
this.pub && this.pub.quit(); | ||
this.sub && this.sub.quit(); | ||
} | ||
createRedisClient() { | ||
@@ -19,0 +25,0 @@ return redis.createClient({ url: this.url }); |
@@ -8,2 +8,3 @@ import { Server } from './server'; | ||
listen(callback: () => void): void; | ||
close(): void; | ||
bindHandler(socket: any): void; | ||
@@ -10,0 +11,0 @@ handleMessage(socket: any, msg: { |
@@ -17,2 +17,5 @@ "use strict"; | ||
} | ||
close() { | ||
this.server.close(); | ||
} | ||
bindHandler(socket) { | ||
@@ -19,0 +22,0 @@ const sock = this.getSocketInstance(socket); |
@@ -5,2 +5,3 @@ export declare abstract class Server { | ||
abstract listen(callback: () => void): any; | ||
abstract close(): void; | ||
getHandlers(): {}; | ||
@@ -7,0 +8,0 @@ add(pattern: any, callback: any): void; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
35515
623
123
1
5