Skip to content

Repository files navigation

Fanoosa.JS

Fanoosa.JS is a simple Node.js application that demonstrates basic server setup, routing, error handling, and request processing. This project helps in understanding how to structure a Node.js application, create a server, define routes, handle errors, and work with controllers.

Features

  • HTTP Server: A basic HTTP server created using Node.js.
  • Routing: A flexible routing system to define and resolve routes based on HTTP methods.
  • Error Handling: A centralized error handler to manage different types of errors like 404 (not found), 400 (bad request), and 500 (server error).
  • Form Handling: Integration with formidable to handle form data parsing and validation.
  • Pagination: Pagination feature to handle large sets of data.
  • MVC Architecture: The project follows the MVC (Model-View-Controller) design pattern for better organization and scalability.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js (v14 or later)
  • npm (Node Package Manager)
  • dotenv for environment variable management

Installation

  1. Clone the repository:

    git clone https://github.com/thesiamak01/fanoosa-js.git
    cd fanoosa-js
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory and set the desired configurations (e.g., port):

    PORT=5000
  4. Start the server:

    npm run dev

    The server will start and be accessible at http://localhost:5000.

How It Works

  1. Server: The application starts an HTTP server listening on the port defined in .env.
  2. Routes: The routes are defined in the Routes.js file and added to the Router class.
  3. Request Handling: Incoming requests are processed by the RequestHandler which matches the routes and invokes the appropriate controller method.
  4. Error Handling: Errors are caught and handled by the ErrorHandler class which categorizes them and sends appropriate HTTP responses.

Contributing

If you'd like to contribute to Fanoosa.JS, feel free to fork the repository, make changes, and submit a pull request.

About

Fanoosa.JS is a simple Node.js application that demonstrates basic server setup, routing, error handling, and request processing.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages