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
  • routejs
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles

This view

  • Original page
  • New address

GeezerVison is showing github.com — Routejs

README.md

Routejs Logo

NPM Version NPM Install Size NPM Downloads

Routejs is a fast and lightweight http routing engine for Node.js

Features

  • Fast and lightweight
  • Group routing
  • Host based routing
  • Named routing
  • Middleware support
  • Object and array based routing
  • Regular expression support

Installation

Install using npm:

$ npm i @routejs/router

Install using yarn:

$ yarn add @routejs/router

Example

const { Router } = require("@routejs/router");
const http = require("http");

const app = new Router();

app.get("/", function (req, res) {
  res.end("Ok");
});

// Create 404 page not found error
app.use(function (req, res) {
  res.writeHead(404).end("404 Page Not Found");
});

http.createServer(app.handler()).listen(3000);

Url route example

Routejs is very simple and flexible, it support both object and array based url routing.

Let's create urls.js urls file for routes:

const { path, use } = require("@routejs/router");

// Url routes
const urls = [
  path("get", "/", (req, res) => res.end("Ok")),
  // Create 404 page not found error
  use((req, res) => res.writeHead(404).end("404 Page Not Found")),
];

module.exports = urls;

Use urls in routejs app:

const { Router } = require("@routejs/router");
const http = require("http");
const urls = require("./urls");

const app = new Router();

// Use url routes
app.use(urls);

http.createServer(app.handler()).listen(3000);

Documentation

  • Learn more from Documentation
  • Documentation : https://routejs.github.io/docs

License

MIT License

Pinned Loading

  1. router router Public

    Fast and lightweight http routing engine for nodejs

    JavaScript 21 3

  2. docs docs Public

    Fast and lightweight http router for nodejs

    3 2

Repositories

Loading
Type
Language
Sort
Showing 5 of 5 repositories
  • docs Public

    Fast and lightweight http router for nodejs

    Uh oh!

    There was an error while loading. Please reload this page.

    routejs/docs's past year of commit activity
    3 MIT 2 0 0 Updated Apr 2, 2024
  • router Public

    Fast and lightweight http routing engine for nodejs

    Uh oh!

    There was an error while loading. Please reload this page.

    routejs/router's past year of commit activity
    JavaScript 21 MIT 3 0 0 Updated Jan 4, 2024
  • response Public

    Http response wrapper

    Uh oh!

    There was an error while loading. Please reload this page.

    routejs/response's past year of commit activity
    JavaScript 1 MIT 0 0 0 Updated Mar 22, 2023
  • request Public

    Http request wapper for nodejs

    Uh oh!

    There was an error while loading. Please reload this page.

    routejs/request's past year of commit activity
    JavaScript 1 MIT 0 0 0 Updated Mar 22, 2023
  • .github Public

    Uh oh!

    There was an error while loading. Please reload this page.

    routejs/.github's past year of commit activity
    1 MIT 0 0 0 Updated Feb 15, 2023

People

@rajkumardusad

Top languages

Loading…

Uh oh!

There was an error while loading. Please reload this page.

Most used topics

Loading…

Uh oh!

There was an error while loading. Please reload this page.

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.