Skip to content

doTryCatch/ExpressClone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ NodeRoute - A Custom Express.js Clone

Learn framework internals by building your own Express.js from scratch!

License: MIT Node.js Version Contributions Welcome

A minimal, educational implementation of Express.js built with pure Node.js and the http module. Perfect for developers who want to understand how web frameworks work under the hood.

🎯 Why This Project?

  • 🧠 Deep Learning: Understand Express.js internals by building it yourself
  • πŸ’Ό Portfolio Project: Showcase your framework knowledge to employers
  • 🀝 Open Source: Contribute to a learning-focused community
  • πŸ“š Educational: Perfect for developers of all skill levels

✨ Features

βœ… Currently Implemented

  • Custom HTTP server with Node.js http module
  • GET request handling
  • Modular routing system
  • JSON response handling
  • Basic middleware support
  • Clean, readable codebase (200 lines)

🚧 Ready for Contribution

  • POST, PUT, DELETE request methods
  • Middleware system
  • Request body parsing
  • Route parameters (/users/:id)
  • Query string support
  • Error handling
  • Static file serving

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           HTTP Requests              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Node.js HTTP Module          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Custom Express Framework       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Server Classβ”‚   Router Class   β”‚  β”‚
β”‚  β”‚ Status Classβ”‚                 β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Application Layer            β”‚
β”‚           (server.js)               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Routing Layer             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Blog Routes β”‚   User Routes    β”‚  β”‚
β”‚  β”‚ /api/blog   β”‚   /api/user      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Node.js (v14.0.0 or higher)
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/noderoute.git
    cd noderoute
  2. Install dependencies

    npm install
  3. Start the server

    node server.js
  4. Test the endpoints

    # Health check
    curl http://localhost:4000/get
    
    # Blog endpoints
    curl http://localhost:4000/api/blog/getBlog
    curl http://localhost:4000/api/blog/getData
    
    # User endpoints
    curl http://localhost:4000/api/user/getUser
    curl http://localhost:4000/api/user/getUserData

πŸ“ Project Structure

noderoute/
β”œβ”€β”€ express.js              # Custom Express implementation
β”œβ”€β”€ server.js               # Main server file
β”œβ”€β”€ router/
β”‚   β”œβ”€β”€ route.js           # Main router configuration
β”‚   β”œβ”€β”€ blogRoute.js       # Blog-related endpoints
β”‚   └── userRoute.js       # User-related endpoints
β”œβ”€β”€ package.json           # Dependencies and scripts
└── README.md              # This file

πŸ”§ API Endpoints

Current Endpoints

Method Endpoint Description
GET /get Health check endpoint
GET /api/blog/getBlog Fetch blog data
GET /api/blog/getData Additional blog endpoint
GET /api/user/getUser User data endpoint
GET /api/user/getUserData Additional user endpoint

Example Responses

// GET /get
{
  "msg": "router is working"
}

// GET /api/blog/getBlog
{
  "mas": "blog data is fetched!!"
}

🀝 Contributing

We welcome contributions from developers of all skill levels! This project is designed to be a learning playground.

🎯 Good First Issues

Beginner Level

  • Add POST request method to express.js
  • Add PUT request method to express.js
  • Add DELETE request method to express.js
  • Implement request body parsing
  • Add basic error handling

Intermediate Level

  • Create middleware system
  • Add route parameters support (/users/:id)
  • Implement query string parsing
  • Add request logging middleware
  • Create static file serving

Advanced Level

  • Add authentication middleware
  • Implement rate limiting
  • Create testing framework
  • Add WebSocket support
  • Performance optimization

πŸš€ How to Contribute

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/add-post-support
  3. Make your changes
  4. Test your implementation
    node server.js
    # Test your endpoints
  5. Submit a pull request

πŸ“ Contribution Guidelines

  • Code Style: Follow existing code patterns
  • Documentation: Update README for new features
  • Testing: Test your changes thoroughly
  • Commit Messages: Use clear, descriptive messages

πŸŽ“ Learning Path

Phase 1: Understanding the Basics (Week 1)

  • Read through express.js to understand the core classes
  • Study server.js to see how everything connects
  • Explore the router files to understand modular routing
  • Test all current endpoints

Phase 2: Your First Contribution (Week 2)

  • Add POST method to the Router class
  • Create a POST endpoint in blogRoute.js
  • Test your implementation
  • Submit your first pull request

Phase 3: Advanced Features (Week 3+)

  • Implement middleware system
  • Add route parameters
  • Create error handling
  • Add request body parsing

🧠 What You'll Learn

Technical Skills

  • HTTP request/response lifecycle
  • Node.js http module usage
  • JavaScript classes and prototypes
  • Middleware patterns
  • Route matching algorithms
  • Error handling strategies

Soft Skills

  • Open source contribution workflow
  • Code review process
  • Documentation writing
  • Community collaboration
  • Problem-solving approach

πŸ† Recognition

  • 🌟 Contributor of the Month: Featured in our newsletter
  • πŸ“œ Learning Certificates: For completing learning paths
  • 🎯 Special Badges: For different types of contributions
  • πŸ“– Blog Features: Get featured in our developer blog

πŸ“š Resources

Learning Materials

Community

πŸ› Bug Reports

Found a bug? Please create an issue with:

  • Clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Your environment details

πŸ’‘ Feature Requests

Have an idea for a new feature? We'd love to hear it! Create an issue with:

  • Detailed feature description
  • Use cases and examples
  • Implementation suggestions (if any)

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by Express.js and the Node.js community
  • Built for educational purposes
  • Thanks to all contributors who make this project better

πŸ“ž Contact


⭐ Star this repository if you found it helpful!

🀝 Contribute to help others learn!

πŸ“š Share with your developer friends!

# ExpressClone # ExpressClone # ExpressClone

About

A simple Express Clone which mimics syntax and behavior of express. Check it out...

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors