LiteNode's logo

LiteNode

Docs GitHub logo
▶ Usage

Documentation

Usage

LiteNode is a minimal and easy to understand Node.js Web framework without external dependencies!

Installation

You can install LiteNode via npm:

npm install litenode
Information SVG BREAKING CHANGE: As of version 3.0.0, LiteNode no longer supports being loaded using require. This change aims to maintain and enhance LiteNode in a modular way, which would be difficult to achieve if backward compatibility with CommonJS were maintained.

Basic Usage

Here is a basic example of how to create a server using LiteNode:

// To use LiteNode in your project, you can import it using ES6 import syntax
import { LiteNode } from "litenode"

// Create a new instance of LiteNode
const app = new LiteNode()

// Define a route
app.get("/", (req, res) => {
    res.end("Hello, LiteNode!")
})

// Start the server on port 5000 by default
app.startServer()

This will start a server listening on port 5000.
The console will output:

Error while reading static directory: "static" directory doesn't exist!
LiteNode will continue running without serving static assets.
App @ http://localhost:5000

Accessing http://localhost:5000 will respond with "Hello, LiteNode!".

Information SVG Ignore the warning messages for now, we'll address them later in Serving Static Files.

Content