Update starter to alpha-23

This commit is contained in:
kamil.mysliwiec 2017-03-19 12:41:07 +01:00
parent 0aabccf76a
commit d884774343
3 changed files with 7 additions and 18 deletions

View File

@ -1,12 +0,0 @@
import { NestApplication } from 'nest.js';
export class Application implements NestApplication {
constructor(private expressApp) {}
start() {
// do something before server start
this.expressApp.listen(3031, () => {
console.log('Application listen on port:', 3031);
});
}
}

View File

@ -1,11 +1,12 @@
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
import { SocketGateway, GatewayServer, SubscribeMessage } from 'nest.js/socket'; import { WebSocketGateway, WebSocketServer, SubscribeMessage } from 'nest.js/websockets';
@SocketGateway({ port: 2000 }) @WebSocketGateway({ port: 2000 })
export class ChatGateway { export class ChatGateway {
private msg$ = new Subject<any>(); private msg$ = new Subject<any>();
@GatewayServer server; @WebSocketServer()
server;
get msgStream() { get msgStream() {
return this.msg$.asObservable(); return this.msg$.asObservable();

View File

@ -1,5 +1,5 @@
import { NestRunner } from 'nest.js'; import { NestFactory } from 'nest.js';
import { Application } from './app';
import { ApplicationModule } from './modules/app.module'; import { ApplicationModule } from './modules/app.module';
NestRunner.run(Application, ApplicationModule); const app = NestFactory.create(ApplicationModule);
app.listen(3000, () => console.log('Application is listening on port 3000.'));