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

orator-serviceserver-base

v1.0.5

Published

Base Orator serviceserver class

Readme

Orator ServiceServer Base

Abstract base class defining the interface for Orator service server implementations

OratorServiceServerBase provides the contract that all Orator service servers must implement. It handles route registration validation and defines the lifecycle methods (listen, close), HTTP verb methods (get, post, put, del, patch, opts, head), middleware registration, and body parsing. Derived classes override the do* methods to provide actual behavior.

Features

  • Interface Contract - Defines the complete API for service server implementations
  • Input Validation - Base methods validate route parameters before delegating to implementations
  • Template Method Pattern - get() validates and calls doGet(), which derived classes override
  • Body Parser Helpers - Convenience methods that combine route registration with body parsing
  • Fable Service Provider - Registers as OratorServiceServer in the Fable service manager

Installation

npm install orator-serviceserver-base

Usage

This module is not used directly in application code. Instead, it serves as the base class for service server implementations like orator-serviceserver-restify and the built-in IPC server.

Creating a Custom Service Server

const libOratorServiceServerBase = require('orator-serviceserver-base');

class MyCustomServiceServer extends libOratorServiceServerBase
{
	constructor(pFable, pOptions, pServiceHash)
	{
		super(pFable, pOptions, pServiceHash);
		this.ServiceServerType = 'MyCustom';
	}

	listen(pPort, fCallback)
	{
		// Start your server listening on pPort
		this.Active = true;
		this.Port = pPort;
		return fCallback();
	}

	close(fCallback)
	{
		// Stop your server
		this.Active = false;
		return fCallback();
	}

	doGet(pRoute, ...fRouteProcessingFunctions)
	{
		// Register a GET route with your server
		return true;
	}

	doPost(pRoute, ...fRouteProcessingFunctions)
	{
		// Register a POST route with your server
		return true;
	}

	// ... implement doPut, doDel, doPatch, doOpts, doHead
}

API Reference

Lifecycle Methods

| Method | Description | |--------|-------------| | listen(pPort, fCallback) | Begin listening on the specified port | | close(fCallback) | Stop listening |

Route Methods

| Method | Description | |--------|-------------| | get(pRoute, ...fHandlers) | Register a GET route handler | | post(pRoute, ...fHandlers) | Register a POST route handler | | put(pRoute, ...fHandlers) | Register a PUT route handler | | del(pRoute, ...fHandlers) | Register a DELETE route handler | | patch(pRoute, ...fHandlers) | Register a PATCH route handler | | opts(pRoute, ...fHandlers) | Register an OPTIONS route handler | | head(pRoute, ...fHandlers) | Register a HEAD route handler |

Body Parser Convenience Methods

| Method | Description | |--------|-------------| | getWithBodyParser(pRoute, ...fHandlers) | GET with automatic body parsing | | postWithBodyParser(pRoute, ...fHandlers) | POST with automatic body parsing | | putWithBodyParser(pRoute, ...fHandlers) | PUT with automatic body parsing | | delWithBodyParser(pRoute, ...fHandlers) | DELETE with automatic body parsing | | patchWithBodyParser(pRoute, ...fHandlers) | PATCH with automatic body parsing | | optsWithBodyParser(pRoute, ...fHandlers) | OPTIONS with automatic body parsing | | headWithBodyParser(pRoute, ...fHandlers) | HEAD with automatic body parsing |

Middleware

| Method | Description | |--------|-------------| | use(fHandlerFunction) | Register a global middleware handler | | bodyParser(pOptions) | Create a body parsing middleware function |

Override Methods

Derived classes should override these:

| Method | Description | |--------|-------------| | doGet(pRoute, ...fHandlers) | Implementation for GET route registration | | doPost(pRoute, ...fHandlers) | Implementation for POST route registration | | doPut(pRoute, ...fHandlers) | Implementation for PUT route registration | | doDel(pRoute, ...fHandlers) | Implementation for DELETE route registration | | doPatch(pRoute, ...fHandlers) | Implementation for PATCH route registration | | doOpts(pRoute, ...fHandlers) | Implementation for OPTIONS route registration | | doHead(pRoute, ...fHandlers) | Implementation for HEAD route registration | | invoke(pMethod, pRoute, pData, fCallback) | Programmatic route invocation |

Properties

| Property | Type | Description | |----------|------|-------------| | ServiceServerType | string | Implementation identifier (e.g., "Base", "Restify", "IPC") | | Name | string | Server name (from fable.settings.Product) | | URL | string | Server URL or identifier | | Port | number | Listening port | | Active | boolean | Whether the server is currently listening |

Documentation

Full documentation is available in the docs folder, or served locally:

npx docsify-cli serve docs

Related Packages