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 LiteNode version 4.0.0, the integrated Simple Template Engine (STE) has been upgraded to a more powerful AST-based template engine. With this update, the engine's tags have been unified to a single signature, making it simpler and more efficient. There are also many new features to explore, so check out the updated documentation to fully take advantage of these improvements.

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