Tomahawk is a minimalist HTTP server designed for Node.js. It provides functionality for serving static content, executing CGI scripts, and defining REST API routes programmatically. Currently at version 0.2.1, its development appears to be abandoned, with its `engines` field explicitly requiring Node.js versions `>= 0.8.0 < 0.11.0`. Node.js 0.8.0 was released in June 2012, and 0.11.0 in March 2013, making this package incompatible with all modern Node.js runtimes. Its key differentiator was its simplicity and dual nature as both a command-line utility for static/CGI serving and a module for basic REST API creation, offering a lightweight alternative during its active period. Compared to contemporary HTTP server solutions, Tomahawk lacks modern features, performance optimizations, and security updates.
npm install tomahawkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use Tomahawk programmatically to set up a basic HTTP server, serve static files, and define REST API routes (GET, PUT) for a simple in-memory database. It includes an example of routing with path parameters and query parameters.
Do not use Tomahawk in any modern Node.js project. It is effectively abandoned. Consider modern alternatives like `http-server`, Express.js, Fastify, or Koa.js for static file serving or API development.
Replace Tomahawk with a actively maintained and secure HTTP server library or framework. There are no security fixes or updates available for this package.
Ensure all imports for Tomahawk use the CommonJS `require()` syntax (e.g., `const tomahawk = require('tomahawk');`).Thoroughly validate and sanitize all user inputs passed to CGI scripts. If using CGI, prefer dedicated, secure solutions rather than an unmaintained package. Better yet, avoid CGI entirely and use a modern API framework.
Run `npm install tomahawk` or `npm install -g tomahawk` if using it as a global CLI tool.
Ensure you call HTTP methods on the `app` instance created by `tomahawk.create()`. Example: `const app = require('tomahawk').create({port:8080, routes: [...]}).start(); app.get(...)`.Stop the application currently using the port, or configure Tomahawk to listen on a different port using the `--port` CLI option or the `port` option in the programmatic `create` method (e.g., `port: 3000`).
Tomahawk is a CommonJS module and cannot be directly imported into an ES Module. You must use a Node.js environment configured for CommonJS (e.g., a `.js` file without `"type": "module"` in `package.json`). Or, preferably, switch to a modern server library that supports ESM.
No dependency data recorded yet.