nvm is not compatible with the npm config "prefix" option: currently set to "/home/user/.npm-global"
Run `nvm use --delete-prefix v6.9.2` to unset it.
user@ubuntu:~$ nvm use --delete-prefix v6.9.2 --silent
user@ubuntu:~$ node --version
v6.9.2
user@ubuntu:~$ npm --version
3.10.9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"files": [ | |
"src/*.ts", | |
"src/model/*.ts" | |
], | |
"compilerOptions": { | |
"target": "es5" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChatServer } from './chat-server'; | |
let app = new ChatServer().getApp(); | |
export { app }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createServer, Server } from 'http'; | |
import * as express from 'express'; | |
import * as socketIo from 'socket.io'; | |
import { Message } from './model'; | |
export class ChatServer { | |
public static readonly PORT:number = 8080; | |
private app: express.Application; | |
private server: Server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class User { | |
constructor(private name: string) {} | |
} | |
export class Message { | |
constructor(private from: User, private content: string) {} | |
} | |
export class ChatMessage extends Message{ | |
constructor(from: User, content: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Observer } from 'rxjs/Observer'; | |
import { Message } from '../model/message'; | |
import { Event } from '../model/event'; | |
import * as socketIo from 'socket.io-client'; | |
const SERVER_URL = 'http://localhost:8080'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { Action } from './shared/model/action'; | |
import { Event } from './shared/model/event'; | |
import { Message } from './shared/model/message'; | |
import { User } from './shared/model/user'; | |
import { SocketService } from './shared/services/socket.service'; | |
@Component({ | |
selector: 'tcc-chat', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"); | |
var ts = require("gulp-typescript"); | |
var tsProject = ts.createProject("tsconfig.json"); | |
gulp.task("build", function () { | |
return tsProject.src() | |
.pipe(tsProject()) | |
.js.pipe(gulp.dest("./dist")); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Person { | |
private id: number; | |
private firstName: string; | |
private address: string; | |
constructor(id: number, firstName: string, address: string) { | |
this.id = id; | |
this.firstName = firstName; | |
this.address = address; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Actions you can take on the App | |
export enum Action { | |
JOINED, | |
LEFT, | |
RENAME | |
} | |
// Socket.io events | |
export enum Event { | |
CONNECT = 'connect', |
OlderNewer