Modules@robinpath/server

@robinpath/server

0.1.0Public

HTTP server creation and management using Node.js built-in http module. Supports routing, static file serving, CORS, and common response helpers.

@robinpath/server

HTTP server creation and management using Node.js built-in http module. Supports routing, static file serving, CORS, and common response helpers.

Category Functions Auth License

Why use this module?

The server module lets you:

  • Create a new HTTP server instance
  • Start listening for incoming connections
  • Stop the server and close all connections
  • Register a handler for all incoming requests
  • Register an error handler for the server

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/server

Quick Start

No credentials needed — start using it right away:

server.start

Available Functions

FunctionDescription
server.createCreate a new HTTP server instance
server.startStart listening for incoming connections
server.stopStop the server and close all connections
server.onRequestRegister a handler for all incoming requests
server.onErrorRegister an error handler for the server
server.routeAdd a route with method, path pattern, and handler
server.staticServe static files from a directory
server.sendJsonSend a JSON response
server.sendHtmlSend an HTML response
server.sendFileSend a file as the response
server.sendRedirectSend an HTTP redirect response
server.statusSend a response with a specific status code
server.corsEnable and configure CORS headers for a server
server.getServersList all active server instances
server.getRoutesList all routes registered on a server

Examples

Start listening for incoming connections

server.start

Stop the server and close all connections

server.stop

Register a handler for all incoming requests

server.onRequest

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/server";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  server.start
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/server
Version0.1.0
LicenseMIT
Unpacked Size7.0 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

web