If you've finished with the other exercises, here are some extensions you can attempt. You can modify your TODO list, or one of the example apps.
status, body, headers
http.createServer(
function(request, response) {
const page = "...";
response.writeHead(200, {"Content-Type": "text/html"});
response.end(page)
}
)
After:
http.createServer(
convertSimpleServer(
function(request) {
return {status: 200,
headers: {"Content-Type": "text/html"},
body: "..."};
}
)
)
http.createServer(
function(request, response) {
if(request.url === "/add" && request.method === "POST") {
...
} else if (request.url === "/" && request.method === "GET") {
...
}
}
)
After:
http.createServer(
convertDataDrivenServer(
{"/" {GET: (request) => {
...
}},
"/add" {POST: (request) => {
...
}}}
)
)