Skip to content

Latest commit

History

History
executable file
81 lines (58 loc) 路 2.5 KB

File metadata and controls

executable file
81 lines (58 loc) 路 2.5 KB

Node.js Learning Notes

01 -

02 -

03 - Functions

  • verities of combinations
  • var keyword related usage
  • global declaration without var or let
  • let keyword related usage
  • simple concatenation
  • ` to be used with ${a} - for expression execution
  • NaN case (Not a number) when performing operation with undefined
  • function - pointing to address of an object
  • function assigned to a variable, and using that var name to be called
  • function - passing an address of another function

04 - Functions

13.0 - Fat arrow function - simple example

13.1 - Fat arrow function - multiple inheritance achieved

Moving towards Application oriented programming

  • create node-projects at c root folder

Learning modular programming

14.0 - HR designation management project (hr.js, eq1.js file under projects: 01_hr)

14_1 - Command line arguments

19-2 - File handling tools available as a wrapper (fs.appendFile())

20

Buffer class for Data Buffering, Seq. of bytes (binary mode), server side

  • creating Buffer for 10 bytes
  • case of over flow

Events (click is an event, move is an event, key up & key down are events)

  • Like some component.on (click on component to be used as an event)
  • Event Emitter is an existing class to be used
  • How to design such events functionality?

Event Wrapper for Network Programming

  • First: Bulb example -- with which bulb event has occurred (source)
  • Second: Network Application (TCP) : meaning Client program - Server program

21

Network Application - Cli-Chat Basic Application

  • Basic Client and Server programs
  • Creating a basic chat application using command line
  • Server software to be run first
    • Server socket to be created
    • Server socket to be bound to a port (is nothing but like a house number /flat number)
    • Wait for client to connect / request
    • Server socket to be listening for connections
    • Server socket to be connected to a client
    • Server socket to be disconnected from a client
    • Server socket to be closed
  • Client software to be run after server software
    • Client socket to be created
    • Client socket to be connected to server
    • Client socket to be disconnected from server
    • Client socket to be closed
  • Communication between client and server
    • Client sends message to server
    • Server receives message from client
    • Server sends message to client
    • Client receives message from server