Index
Video
A video that accompanies this page is here...
Purpose
- Get a feel for a web server (generating and serving content) and a web browser (viewing content)
- Practice using npm for initializing projects (creating "package.json"), and for installing public packages (shared code)
Guide Examples
These sources will guide you. Simply post to the course discussion board if you don't see the guidance you need.
You will also find "Node.js web server" as common fodder on the internet.
Problem Statement
Development
- Create a project directory named "web-server"
- Code a Node.js web server that will display HTML content in a web browser (actual content is coder's choice). Save the code as "web-server.js".
- Use port 3000
- When sending "writeHead", use the "OK" constant from the "http-status-codes" public package as demonstrated in some of the examples (as opposed to hard-coding "200")
- Use npm for project initialization and installing any needed public packages.
Running Program
Your final program should be usable as follows:
- Start (run) your web server (web-server.js)
- A web browser opened to host "localhost" and port 3000 should display your HTML content (generated by your web server)
Submit
Code submission/delivery is two step:
- Delete project "node_modules" directory (if present). Here is why...
- Copy project root directory into archive to submit (please do not nest archives)
- Use ".zip" format for archive
Introduction To Node.js
Web Server Drill