Express-compatible API on Velociradix ​
velociradix/express gives you the Express application shape (app.use, Router, req/res/next, express.json(), …) while Velociradix’s C++ engine owns the socket, HTTP parse, and response bytes.
text
Your Express-style code → velociradix/express stack → Velociradix C++ coreInstall & hello world ​
bash
npm install velociradixjs
import express from "velociradix/express";
import morgan from "morgan";
const app = express();
app.use(morgan("dev"));
app.use(express.json());
app.get("/", (req, res) => {
res.json({ engine: "velociradix", path: req.path });
});
app.post("/echo", (req, res) => {
res.status(201).json({ body: req.body });
});
const api = express.Router();
api.get("/users/:id", (req, res) => {
res.json({ id: req.params.id, base: req.baseUrl });
});
app.use("/api", api);
app.listen(3000);Same import style as Express:
js
import express, {
Router,
json,
urlencoded,
static as serveStatic,
} from "velociradix/express";What matches Express ​
| Area | Behavior |
|---|---|
app.use / Router.use | Middleware stack order, path mounts, baseUrl stripping |
app.get/post/... | Route verbs, :params, req.params / req.query |
app.route(path).get().post() | Chained route |
express.json / urlencoded / text / raw | Body parsers (from buffered native body) |
express.static | Static files with fallthrough |
res.status().json().send().end() | Fluent response API |
res.on('finish') | Works with morgan, response-time, etc. |
| Error middleware | (err, req, res, next) — arity 4 |
| Settings | app.set / get / enable / disable |
What is not Node/Express internals ​
- Not the npm
expresspackage. req/resare bridges, nothttp.IncomingMessage/ServerResponse.- Middleware that needs raw TCP streams, half-open sockets, or Express private fields may fail.
res.renderneeds a view host you wire yourself (stub throws).- HTTP parsing is still Velociradix’s custom C++ parser (not llhttp). See Trust.
Marketing line (honest) ​
Write Express. Run Velociradix.
Use this package when you want Express ergonomics and the Velociradix engine. Use core velociradix + useExpress(morgan()) when you prefer the native (ctx, next) API.
Core bridge (optional) ​
Without the Express subpath, the same bridge exists on the core app:
js
import { createApp } from "velociradix";
import morgan from "morgan";
const app = createApp();
app.use(morgan("dev")); // arity-3 → Express bridge
app.get("/", (ctx) => ctx.json({ ok: true }));
app.listen(3000);