Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 2.13 KB

File metadata and controls

58 lines (44 loc) · 2.13 KB

Node.js Basics Project

A collection of basic Node.js examples demonstrating fundamental concepts like HTTP servers, file operations, modules, and URL handling.

Files Overview

Module Example

  • myDateTime.js - A simple module that exports a function returning the current date and time.

HTTP Server Examples

File System Operations

  • fourthServer.js - Server that reads an HTML file (demoFile.html) and serves its contents.

  • fileCreator.js - Demonstrates various file system operations:

    • Creating files (appendFile, open, writeFile methods)
    • Updating file content
    • Renaming files
    • Run with: node fileCreator.js

HTML File

  • demoFile.html - Simple HTML file used by fourthServer.js to demonstrate serving static content.

Getting Started

  1. Make sure you have Node.js installed.
  2. Clone this repository.
  3. Run any example using the Node.js runtime:
    node filename.js
    
  4. For server examples, open your browser to http://localhost:8080

Learning Objectives

This repository demonstrates:

  • Creating and using Node.js modules
  • Setting up basic HTTP servers
  • Handling URL requests and query parameters
  • Reading and serving HTML files
  • Performing file system operations (create, write, append, rename)