npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lieko-express

v1.0.22

Published

Lieko-express — A Modern, Minimal, express-like Framework for Node.js

Downloads

138

Readme

Lieko Express

A modern, minimal, Express-like framework for Node.js with built-in body parsing, CORS, validation, and more. Lieko-express is designed to be a drop-in replacement for Express.js with additional features and better performance.

Online documentation Lieko Express Documentation

Key Features

  • Express-compatible API: Familiar routing, middleware, and request/response handling.
  • Built-in Body Parsing: JSON, URL-encoded, and multipart form-data support.
  • CORS Support: Configurable cross-origin resource sharing with flexible options.
  • Schema Validation: Built-in validation system with comprehensive validators.
  • Static File Serving: Efficient static file middleware with caching and ETags.
  • Template Engine: Simple HTML templating with support for custom engines.
  • Route Groups: Organize routes with nested groups and shared middleware.
  • Debug Mode: Detailed request logging with timing and payload information.

Note: Lieko-express requires Node.js ≥14.0.0.

Installation

NPM

npm install lieko-express

Yarn

yarn add lieko-express

Quick Start

Create your first Lieko-express application:

const Lieko = require('lieko-express');
const app = Lieko();

app.get('/', (req, res) => {
  res.json({ message: 'Hello World!' });
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});

Basic REST API Example

const Lieko = require('lieko-express');
const app = Lieko();

// Enable debug mode
app.debug(true);

// Simple in-memory database
const users = [];
let idCounter = 1;

// Get all users
app.get('/api/users', (req, res) => {
  res.json(users);
});

// Get user by ID
app.get('/api/users/:id', (req, res) => {
  const user = users.find(u => u.id === req.params.id);
  
  if (!user) {
    return res.status(404).json({ 
      error: 'User not found' 
    });
  }
  
  res.json(user);
});

// Create user
app.post('/api/users', (req, res) => {
  const user = {
    id: String(idCounter++),
    name: req.body.name,
    email: req.body.email,
    createdAt: new Date().toISOString()
  };
  
  users.push(user);
  res.status(201).json(user);
});

// Update user
app.patch('/api/users/:id', (req, res) => {
  const user = users.find(u => u.id === req.params.id);
  
  if (!user) {
    return res.status(404).json({ 
      error: 'User not found' 
    });
  }
  
  Object.assign(user, req.body);
  res.json(user);
});

// Delete user
app.delete('/api/users/:id', (req, res) => {
  const index = users.findIndex(u => u.id === req.params.id);
  
  if (index === -1) {
    return res.status(404).json({ 
      error: 'User not found' 
    });
  }
  
  users.splice(index, 1);
  res.status(204).end();
});

app.listen(3000, () => {
  console.log('API running on http://localhost:3000');
});

Configuration

Customize Lieko-express with settings:

const app = Lieko();

// Enable/disable features
app.set('x-powered-by', 'MyApp');
app.set('trust proxy', true);
app.set('views', './templates');
app.set('view engine', 'html');

// Enable debug mode
app.debug(true);

// Disable strict trailing slash
app.set('strictTrailingSlash', false);
app.set('allowTrailingSlash', true);

Configuration Options

| Setting | Type | Default | Description | |----------------------|---------------|---------------|---------------------------------| | debug | boolean | false | Enable detailed request logging | | x-powered-by | string|boolean | 'lieko-express' | X-Powered-By header value | | trust proxy | boolean | false | Trust X-Forwarded-* headers | | strictTrailingSlash | boolean | true | Strict trailing slash matching | | allowTrailingSlash | boolean | true | Allow optional trailing slash | | views | string | './views' | Template directory path | | view engine | string | 'html' | Default template engine |

Routing

Define routes with flexible patterns:

// GET request
app.get('/users', (req, res) => {
  res.json({ users: [] });
});

// POST request
app.post('/users', (req, res) => {
  res.status(201).json({ message: 'User created' });
});

// Route parameters
app.get('/users/:id', (req, res) => {
  const userId = req.params.id;
  res.json({ userId });
});

// Multiple handlers
app.get('/protected', authMiddleware, (req, res) => {
  res.json({ message: 'Protected route' });
});

Middleware

Middleware for request processing:

// Application-level
app.use((req, res, next) => {
  console.log(`${req.method} ${req.url}`);
  next();
});

// Error handling
app.errorHandler((err, req, res, next) => {
  console.error('Error:', err.message);
  res.status(err.status || 500).json({
    error: {
      message: err.message,
      code: err.code || 'SERVER_ERROR'
    }
  });
});

Request Object

Properties and methods:

| Property | Type | Description | |-------------------|---------|--------------------------------------| | req.body | object | Parsed request body | | req.params | object | Route parameters | | req.query | object | Query string parameters | | req.files | object | Uploaded files | | req.headers | object | HTTP headers | | req.method | string | HTTP method |

Methods like req.get('Content-Type'), req.accepts(['json', 'html']).

Response Object

Methods for sending responses:

// Send JSON
res.json({ message: 'Hello' });

// Status and helpers
res.status(201).json({ message: 'Created' });
res.ok({ data: users });
res.created({ user });
res.noContent();
res.badRequest('Invalid input');
res.redirect('/new-url');

Body Parsing

Automatic parsing with limits:

app.bodyParser({
  limit: '50mb',
  extended: true,
  strict: true
});

CORS

Configure CORS:

app.cors({
  origin: '*',
  methods: ['GET', 'POST'],
  credentials: true
});

Static Files

Serve static files:

app.use(app.static('public'));

Template Engine

Render templates:

res.render('index', {
  title: 'My Page',
  user: { name: 'Alice' }
});

Schema Validation

Validate requests:

const { Schema, validators: v, validate } = require('lieko-express');

const schema = new Schema({
  name: [v.required(), v.string(), v.minLength(3)],
  age: [v.optional(), v.number(), v.min(18)]
});

app.post('/users', validate(schema), (req, res) => {
  res.created(req.body);
});

Route Groups

Organize routes:

app.group('/api', (api) => {
  api.get('/users', handler);
  api.post('/users', handler);
});

Error Handling

Custom handlers:

app.notFound((req, res) => {
  res.notFound('Page not found');
});

Cookies

Set and clear cookies:

res.cookie('session', 'abc123', {
  maxAge: 86400000,
  httpOnly: true,
  secure: true
});

res.clearCookie('session');

File Uploads

Handle uploads:

app.post('/upload', (req, res) => {
  const file = req.files.avatar;
  // Process file
});

API Methods Reference

See the full documentation for complete lists of application and response methods.

Validators Reference

Built-in validators like v.required(), v.email(), v.min(10).

Best Practices

  • Use modular routes and controllers.
  • Handle environment variables with dotenv.
  • Implement security headers.
  • Add rate limiting for APIs.

Examples

Basic REST API

(See code in Quick Start)

Authentication

JWT-based auth example (see full code in documentation).

File Upload

Upload service example (see full code in documentation).

Real-world App

Blog API with auth and posts (see full code in documentation).

Contributing

Contributions welcome! Please submit issues or pull requests on GitHub.

License

MIT License. See LICENSE for details.