T9 APIs · Lesson 6
Games: Error handling
Choose the right option, fill in the blanks, write small pieces of code and fix broken ones. Code runs in a safe box inside this page.
Solved 0 of 47 items in this lesson.
1 / 23
This program is an Express app and its own client, run in the shop's folder. What does it print?
cat > app.js <<'END'
const express = require("express");
const app = express();
app.get("/boom", (req, res) => { throw new Error("the boiler burst"); });
const server = app.listen(3000, async () => {
const r = await fetch("http://localhost:3000/boom");
console.log(r.status, r.headers.get("content-type").split(";")[0]);
server.close();
});
END
node app.js 2>/dev/null