An interface for creating HTTP servers, together with powerful features and extensions.
- Effective and performant HTTP interface.
- Shortcut behaviour, like gateways and redirects.
- Optional integration of EJS templates.
- Native cookie parsing.
- Rich extension management.
npm install @serverful/core
const Serverful = require("@serverful/core");
// ...Creation of a Serverful instance.
const MyServer = new Serverful(Port);Registration of Serverful extensions.
Serverful.Extension(ServerfulExtension);// /**
MyServer.Incoming(Handler);
// /public/**
MyServer.Gateway("public", Handler);
// /api/**
MyServer.Gateway("api", Handler);// Handler
// Redirect the user relatively or absolute.
Packet.Request.Redirect("/dashboard/index");
Packet.Request.Redirect("https://duckduckgo.com/");
// Render an EJS template.
Packet.Request.Render(EJSTemplate, Document)
.then(() => Packet.Request.End(200))
.catch(() => Packet.Request.End(500));
// JSON.
Packet.Request.JSON(Document);This module is licensed under Apache 2.0.