GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - FarrelAD/Basic-Web-Server-NodeJS: This repository demonstrates a simple web server written natively in Node.js.

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
docs/img
docs/img
 
 
src
src
 
 
.gitignore
.gitignore
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
README.md
README.md
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Basic Node.js Web Service Project

NodeJS

This is a basic web service project built with native Node.js, without any external frameworks. It covers basic routing, handling different HTTP methods, and working with URL parameters and query strings. The goal of this project is to serve as a reference for anyone looking to understand how a web service can be written using just Node.js.

Features

  • Basic Routing: Set up routes for different endpoints.
  • Route with Parameters: Handle dynamic routes with URL parameters.
  • Query Parameters: Extract and process query strings from the URL.
  • HTTP Methods: Support for common HTTP method: GET, POST, PUT, DELETE

Getting Started

Prerequisites

Ensure you have Node.js installed on your machine.

  • Download Node.js

Installation

  1. Clone the repository:
    git clone https://github.com/FarrelAD/Basic-Web-Service-NodeJS.git
  2. Navigate into the project directory:
    cd Basic-Web-Service-NodeJS
  3. Install any required dependencies (if applicable):
    npm install

Running the Server

To start the web service, run the following command:

npm run start

The server will be running at http://localhost:5000

Endpoints

Here are the key endpoints that you can interact with:

GET / : Returns a simple welcome message and provide simple form to handle request input
GET /users : Fetch all users
GET /users/:id : Fetch a data by their ID
POST /users : Add a new user
PUT /users/:id : Update user information
DELETE /users/:id : Delete a user by their ID
GET /search?name=&job= : Retrieves data based on user input from a search form, filtering results by name and job

Query Parameters

Example: /search?name=John&job=data+analyst Query parameters can be extracted and used in request processing.

HTTP Methods

The service supports the following HTTP methods:

GET: Retrieve data.
POST: Submit new data.
PUT: Update existing data.
DELETE: Remove data.

Code Structure

The project is simple and has the following structure:

/root
├─ index.js       # Main server logic
└── /src
       ├─ /controller # A handler for any request
       ├─ /data           # JavaScript object format to store dummy data
       └─ /routes         # Contains routing logic for different endpoints

License

This project is licensed under the MIT License.

Acknowledgments

This project is intended to help others learn the basics of building a web service with Node.js.

About

This repository demonstrates a simple web server written natively in Node.js.

Topics

basichttphttp-servernodejsnodejs-nativenodejs-serverrequest-response

Resources

Readme

Contributing

Contributing
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.