https://github.com/ajmalfaris11/node-server-basics
A Node.js project for studying server creation and management using only Node.js and its core modules, without any external libraries
https://github.com/ajmalfaris11/node-server-basics
backendfundamentals coremodules nodejs nodelearning nodeserver servercreation webserverbasics
Last synced: 4 months ago
JSON representation
A Node.js project for studying server creation and management using only Node.js and its core modules, without any external libraries
- Host: GitHub
- URL: https://github.com/ajmalfaris11/node-server-basics
- Owner: ajmalfaris11
- Created: 2024-11-12T12:05:07.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T12:54:00.000Z (11 months ago)
- Last Synced: 2025-05-14T08:11:54.376Z (5 months ago)
- Topics: backendfundamentals, coremodules, nodejs, nodelearning, nodeserver, servercreation, webserverbasics
- Language: JavaScript
- Homepage:
- Size: 284 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Server Basics
This project is a simple HTTP server built with Node.js using only core modules, without any external libraries except for **Nodemon** (installed for development convenience). The server responds to specific routes with custom messages and demonstrates fundamental server creation and route handling in Node.js.
## Features
- **Root Route ("/")**: Returns a welcome message when accessed via a GET request.
- **Add Route ("/add")**: Returns a message indicating the add page for a GET request.
- **Admin Route ("/admin")**: Returns a message indicating the admin page for a GET request.## Getting Started
### Prerequisites
Ensure that you have [Node.js](https://nodejs.org/) installed on your machine.
### Installation
1. Clone the repository:
```bash
git clone (https://github.com/ajmalfaris11/node-server-basics.git)
```
2. Navigate to the project directory:
```bash
cd
```
3. Initialize the project with npm and install **Nodemon**:
```bash
npm init -y
npm install nodemon --save-dev
```### Usage
To start the server with **Nodemon** for auto-restarts:
```bash
npx nodemon .js
```Alternatively, you can start the server with:
```bash
node .js
```The server will be accessible at `http://localhost:3200`.
### Server Routes
| Route | Method | Description |
|-------------|--------|---------------------------------|
| `/` | GET | Returns a welcome message |
| `/add` | GET | Returns the add page message |
| `/admin` | GET | Returns the admin page message |## Project Summary
This project showcases the following:
- Basic HTTP server creation using Node.js.
- Handling specific routes and responding with custom messages.
- **Nodemon** setup for development ease, allowing for automatic restarts upon file changes.