Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIT737-2.1P: Developing and Deploying a Node.js Web Server

Introduction

This project demonstrates how to set up a basic Node.js web server using Express.js and deploy it to a GitHub repository. The server renders student-specific data upon request.

Technologies & Tools Used

  • Node.js - JavaScript runtime for backend development
  • Express.js - Web framework for Node.js
  • Git - Version control system
  • GitHub - Remote repository hosting
  • Visual Studio Code - Code editor
  • Command Line Interface (CLI) - For executing commands

Step-by-Step Implementation

1. Setting Up the Development Environment

Before implementing the server, ensure the development environment is properly configured.

Install Required Tools

  • Visual Studio Code: Download and install from VS Code
  • Node.js: Download and install from Node.js
  • Git: Install from Git

2. Creating the Node.js Web Server

Initialize the Project

  1. Open terminal and create a project directory:
    mkdir SIT737-NodeServer
    cd SIT737-NodeServer
  2. Initialize a Node.js project:
    npm init -y
    This generates package.json for dependency management.

Install Express.js

npm install express

Create the Server File

  1. Inside the project folder, create a file named server.js.
  2. Add the following code:
    const express = require('express');
    const app = express();
    const port = 3000;
    
    app.get('/', (req, res) => {
        res.send('Welcome to SIT737 Node.js Web Server!');
    });
    
    app.listen(port, () => {
        console.log(`Server running at http://localhost:${port}`);
    });

Run the Server

node server.js

Open http://localhost:3000 in a browser to verify.


3. Configuring Git & GitHub

Initialize Git Repository

git init
git add .
git commit -m "Initial commit - Setting up Node.js web server"

Push Project to GitHub

  1. Create a new repository on GitHub (e.g., sit737-2025-prac2p).
  2. Link the local repository to GitHub:
    git remote add origin https://github.com/himanshudhaka17/sit737-2025-prac2p.git
    git branch -M main
    git push -u origin main

Screenshots

  1. Server Running in Terminal: Server Running
  2. Browser Output: Webpage Output
  3. GitHub Repository: GitHub Repo

Conclusion

This project successfully demonstrates the setup and deployment of a basic Node.js web server using Express.js. The repository is now live on GitHub for future development and collaboration.

GitHub Repository: https://github.com/himanshudhaka17/sit737-2025-prac2p

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages