AI Generated Cheatsheets

Node.js Cheatsheet

Overview

Installation

Basic Usage

Common Modules

NPM

Example

// Example Node.js file
const http = require('http');

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello, world!');
});

server.listen(3000, () => {
  console.log('Server running on port 3000');
});

This Node.js file creates a simple HTTP server that listens on port 3000 and responds with the message “Hello, world!”.

Resources