local-node-server-bundle
v1.0.3
Published
Local Node.js server bundle for application integration
Readme
Local Node Server Bundle
A simple, reusable Node.js server bundle that can be integrated into other applications. Includes Node v22.14 runtime.
Installation
npm install local-node-server-bundleUsage
const LocalNodeServer = require('local-node-server-bundle');
// Create a new server instance
const server = new LocalNodeServer({
port: 3000, // optional, defaults to 3000
nodeExePath: './custom-node.exe' // optional, defaults to bundled Node v22.14
});
// Add custom routes
server.addRoute('get', '/api/data', (req, res) => {
res.json({ message: 'Hello World' });
});
// Start the server
server.start()
.then(() => console.log('Server started'))
.catch(console.error);
// Run a script with the bundled Node executable
server.runScript('path/to/script.js', ['--arg1', '--arg2']);
// To stop the server and all child processes
// server.stop();Features
- Easy to integrate
- Bundled with Node v22.14 runtime
- Custom Node executable support
- CORS enabled
- JSON body parsing
- Custom route support
- Promise-based start/stop methods
- Child process management for running additional scripts
Directory Structure
local-node-server-bundle/
├── index.js # Main server module
├── node-v22.14/ # Bundled Node.js runtime
│ └── node.exe # Node.js executable
├── test.js # Test suite
└── README.md # This file