Registry / devops / novaxjs2

novaxjs2

JSON →
library9.4.4jsnpmunverified

NovaxJS 2 is a lightweight, high-performance web framework for Node.js (latest v9.4.4) focused on simplicity and extensibility. It features intuitive routing with named regex groups, a powerful template engine with @include directives, destructuring, and function calls, middleware pipeline with error handling, static file serving, CORS with dynamic origin checking, plugin system, comprehensive error handling with status-specific handlers, cookie management, file uploads with configurable limits, HTML minification, and request utilities. It is designed as an alternative to Express.js with a more integrated feature set, including built-in template engine and file handling, without external dependencies. Release cadence is frequent (minor and patch releases weekly). Key differentiators: all-in-one framework with template engine and file uploads, zero external dependencies, and dynamic CORS origin checking.

npm install novaxjs2
INSTALL
IMPORT
SIG · NOVAXJS2
N
novaxjs2
devopsjavascriptv9.4.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import Novax from 'novaxjs2'
const Novax = require('novaxjs2')
ESM-only since v9.0.0; CommonJS require() will fail with default export.
Router
import { Router } from 'novaxjs2'
Named export for modular routing; available since v9.2.0.
static
import { static as serveStatic } from 'novaxjs2'
Must rename because 'static' is a reserved word in JavaScript.
sendFile
app.sendFile('./document.pdf', res)
res.sendFile('./document.pdf')
sendFile is a method on the app instance, not on res; this broke before v9.4.4 due to a bug.
res.status
res.status(404).json({ error: 'Not found' })
res.statusCode = 404; res.json({ error: 'Not found' })
Use res.status() to chain; res.statusCode property was buggy before v9.4.3.

Shows basic server setup with routes, parameterized route, middleware, dynamic CORS, and JSON read.

import Novax from 'novaxjs2'; const app = new Novax(); app.get('/', (req, res) => { res.send('<h1>Hello World</h1>'); }); app.get('/json', (req, res) => { res.json({ message: 'Hi from NovaxJS 2', version: '9.4.4' }); }); app.get('/user/:id', (req, res) => { res.send(`User ID: ${req.params.id}`); }); app.useMiddleware((req, res, next) => { console.log(`${req.method} ${req.url}`); next(); }); app.cors({ origin: (origin, callback) => { const allowed = ['https://example.com']; // dynamic origin check callback(null, allowed.includes(origin) ? origin : false); }, methods: 'GET,POST,PUT', }); app.listen(3000, () => { console.log('Server running on http://localhost:3000'); });
Debug
Known issues
breakingDefault import changed to ESM-only in v9.0.0.
fix
Use 'import Novax from "novaxjs2"' instead of require().
affects: >=9.0.0
deprecatedsendFile was crashing in v9.4.3 and earlier due to variable name typo.
fix
Upgrade to v9.4.4 where the bug is fixed.
affects: 9.4.3
gotchares.status() did not apply status codes correctly before v9.4.3.
fix
Upgrade to v9.4.3+ or use app.on(statusCode, handler) as workaround.
affects: <9.4.3
gotchaUsing res.statusCode property directly may not work consistently; chaining res.status() is recommended.
fix
Always use res.status(code).send() or res.status(code).json() instead of setting res.statusCode.
affects: >=9.4.3
gotchaTemplate engine @include() syntax requires the path to be relative to the views folder, not absolute.
fix
Use @include('partials/header.html') instead of @include('/full/path/header.html').
affects: >=9.0.0
Errors
Common errors & fixes
Error: TypeError: Cannot read properties of undefined (reading 'statusCode')
In older versions (<9.4.3) the internal response object was not properly initialized for status codes.
fix
Upgrade to v9.4.3+ and use res.status(code).send() instead of direct statusCode assignment.
Error reading file
In v9.4.3, sendFile() had a bug using 'res.statusCode || 200' instead of 'response.statusCode || 200', causing a crash.
fix
Update to v9.4.4 where the bug is fixed.
SyntaxError: The requested module 'novaxjs2' does not provide an export named 'default'
Using CommonJS require() on an ESM-only package (v9.0.0+).
fix
Switch to ES modules: use import Novax from 'novaxjs2' and ensure package.json has "type": "module".
Error: listen EADDRINUSE :::3000
Port 3000 is occupied by another process or previous server instance.
fix
Change the port in app.listen() or kill the process. On Linux: lsof -i :3000, then kill -9 <PID>.
Upgrade
Version history
9.4.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
novaxjs2 — npm install novaxjs2 · libregistry