Netpress Laravel-inspired backend framework for Node.js
Frameworkv0.1.14 Starterv0.1.12 Docsv1.0.3
Overview Installation Architecture CLI
Core Concepts

Response System

Netpress has a smart response layer so controllers can stay simple.

A route handler can return a value, and Netpress will turn that value into the correct HTTP response when possible.

Common Response Styles

Response Helpers

The starter decorates res with helpers like:

  • res.success(data, meta?)
  • res.error(message, status?, errors?)
  • res.paginate(items, total, page, perPage)
  • res.render(componentOrName, props, status?)

Example:

async index(_req, res) {
  return res.success([{ id: 1, name: 'Amina' }]);
}

Response Builders

Netpress also exports explicit builders:

  • json(data, status?)
  • view(component, props?)
  • redirect(path)

Example:

import { json, redirect } from '@admicaa/netpress';

return json({ ok: true }, 201);
return redirect('/login');

Plain Return Values

If a handler returns a plain object or array, Netpress will serialize it as JSON.

async health() {
  return { status: 'ok' };
}

Why This Helps

  • Controllers need less boilerplate.
  • Return types stay predictable.
  • Teams can standardize response style across the app.

Use one of these approaches consistently:

  • res.success() / res.error() for API-heavy apps
  • json() / redirect() / view() when you want explicit intent
  • plain returned objects for very small handlers

Consistency matters more than the specific choice.