echo 'console.log("Hello from Node.js!")' > hello.js
node hello.js
// "Hello from Node.js!"
const fs = require('fs');
const path = require('path');
const os = require('os');
console.log('Platform:', os.platform());
console.log('CPUs:', os.cpus().length);
console.log('Free memory:',
Math.round(os.freemem() / 1024 / 1024), 'MB');
// Read a file
const content = fs.readFileSync(
path.join(__dirname, 'hello.js'), 'utf-8'
);
console.log('File content:', content);
const http = require('http');
const server = http.createServer((req, res) => {
if (req.url === '/api/health'
&& req.method === 'GET') {
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({
status: 'ok',
timestamp: new Date()
}));
} else {
res.writeHead(404);
res.end('Not Found');
}
});
server.listen(3000, () => {
console.log(
'Server running at http://localhost:3000'
);
});
Open http://localhost:3000/api/health in browser — see JSON response. The browser is now the client and your terminal is the server.
Identify the entry point, recognize familiar JS patterns. It's the same language — functions, objects, arrays, async/await — just with different APIs.
git switch -c feature/PIXELCRAFT-043-node-server
git add server.js package.json
git commit -m "Create basic Node.js HTTP server (PIXELCRAFT-043)"
git push origin feature/PIXELCRAFT-043-node-server
# PR → Review → Merge → Close ticket ✅
Runtime environments.
The language stays the same, only the APIs change. Understanding this lets you learn any new environment quickly.