let x
=>
.map()
<div>
color: teal
______
______
Theebug
Theebug — Learn to Code by Doing
Light
Start Learning
Explorer
···
▼
THEEBUG
index.tsx
learn.md
docs.md
about.md
faq.md
leaderboard.md
updates.md
learn.md
THEEBUG
›
learn.md
Browse more courses
Node.js
Modules, the file system, HTTP servers, and async I/O — JavaScript on the server.
Start Course
Beginner
3 levels
01 — lesson1.js
easy
CommonJS Modules
1
function greet(name) {
2
return `Hello, ${name}!`;
3
}
4
5
module.exports = [ ___ ];
Export the greet function so another file can require() and use it
Play
02 — lesson2.js
easy
require() & Built-in Modules
1
const path = [ ___ ]("path");
2
3
console.log(path.join("data", "users.json"));
Require Node's built-in path module to join two path segments safely
Play
03 — lesson3.js
easy
Reading Files with fs
1
const fs = require("fs");
2
3
const contents = fs.readFileSync("notes.txt", [ ___ ]);
4
console.log(contents);
Read notes.txt synchronously as a UTF-8 string
Play
Intermediate
2 levels
04 — lesson4.js
medium
Creating an HTTP Server
1
const http = require("http");
2
3
const server = http.createServer((req, res) => {
4
res.end("Hello from Node!");
5
});
Start the server listening on port 3000
Play
05 — lesson5.js
medium
Async/Await with fs.promises
1
const fs = require("fs/promises");
2
3
async function loadNotes() {
4
const contents = [ ___ ] fs.readFile("notes.txt", "utf8");
5
console.log(contents);
Await the promise-based readFile so the function pauses until the read c…
Play
Advanced
1 level
06 — lesson6.js
hard
Basic Express Routing
1
const express = require("express");
2
const app = express();
3
4
app.[ ___ ]("/users", (req, res) => {
5
res.json(["Ada", "Bo"]);
Register a GET route for /users using Express's routing method
Play
main
UTF-8
Markdown