Analise e Desenvolvimento de Sistemas - 4º periodo

octodex-img
import * as http from 'http';

class Server {
  private port: number;
  
  constructor(port: number) {
    this.port = port;
  }
  
  start() {
    const server = http.createServer((request, response) => {
      response.end('Hello World!');
    });
    
    server.listen(this.port, () => {
      console.log(`Server started on port ${this.port}`);
    });
  }
}

const server = new Server(3000);
server.start();