Sistemas y Tecnologías Web: Servidor

Master de II. ULL. 1er cuatrimestre


Organization ULL-MII-SYTWS-2122   Classroom ULL-MII-SYTWS-2122   Campus Virtual SYTWS   Chat Chat   Profesor Casiano

Table of Contents

Networking

Práctica Networking

  • Lea el Capítulo 3 “Networking with Sockets” de Node.js 8 the Right Way y resuelva los problemas en la secciónes Testability y Robustness

Testability exercises

  • Add a unit test for a single message that is split over two or more data events from the stream
  • Add a unit test that passes in null to the LDJClient constructor, and asserts that an error is thrown
  • Then make the test pass by modifying the constructor to accept null: the semantic being that the created stream behaves as /dev/null in Unix. See npm package dev-null

Robustness exercises

  • The LDJClient already handles the case in which a properly formatted JSON string is split over multiply lines. What happen if the incoming data is not a properly formatted JSON string?
  • Write a test case that sends a data event that is not JSON. What do you think on how to manage this case?
  • What happens if the last data event completes a a JSON message, but without the trailing new line?
  • Write a case where the stream object sends a data event containing JSON but no newline, followed by a close event. How will you manage this case?
  • Should LDJClient emit a close event for its listeners?

Requirements

Recursos

Node.js the Right Way book

UPM MOOC on Node.JS

Net module

Gulp

GitHub Actions

CI and Travis

Documentación

Pruebas

Recursos para el profesor

  • GitHub repo ULL-MII-CA-1819/nodejs-the-right-way (private repo)
    • Paths related:
      1
      2
      3
      4
      
      [~/sol-nodejs-the-right-way/networking-with-sockets-chapter-3(master)]$ pwd -P
      /Users/casiano/local/src/CA/sol-nodejs-the-right-way/networking-with-sockets-chapter-3
      
      
  • sol-c (private repo)
    • See the branch chapter3-exercises
  • Sol -ai (private repo)

Comment with GitHub Utterances