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