A Simple Web Server

CSCI-UA.0480-008

A Live Coding Experiment!

  • Goal - make a library that allows you to do something like …
  • Architecture
    • App
      • listen
      • get
    • Request
      • path
      • headers
      • body
    • Response
      • write
      • end
      • setHeader
      • send

Let's Try to Do This

  • Serve an HTML Page
  • A quick diversion into fs.readFile
  • Serve an Image
  • Wrap everything in an App object
    • watch out for this and callbacks!!!
  • Wrap response in Response object
  • In class activity
  • Switch Response based on parsed request