
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@rubynetwork/rammerhead
Advanced tools
npx @rubynetwork/rammerhead
-ho, --host <host>
- Listen on a specific host (default: 0.0.0.0
)-p, --port <port>
- The port to listen on (default: 8080
)-l, --loglevel <loglevel>
- Change the log level (default: debug
) [options: disabled
, debug
, traffic
, info
, warn
, error
]-rp, --reverseproxy
- Whether or not the server is behind a reverse proxy. (default: false
)-h, --help
- Show this same type of infoimport { createRammerhead, shouldRouteRh, routeRhUpgrade, routeRhRequest } from '@rubynetwork/rammerhead';
const rh = createRammerhead({
logLevel: 'debug', //Options are: disabled, debug, traffic, info, warn, error (default: debug)
reverseProxy: false, //whether or not this server is running behind a reverse proxy (default: false)
disableLocalStorageSync: false, //disable localstorage sync (not recommended) (default: false)
disableHttp2: false //disable http2 usage (default: false) (NOT RECOMMENDED)
})
const server = http.createServer();
server.on('request', (req, res) => {
if (shouldRouteRh(req)) {
routeRhRequest(rh /* from the createRammerhead function MUST be passed */, req, res)
}
})
server.on('upgrade', (req, socket, head) => {
if (shouldRouteRh(req)) {
routeRhUpgrade(rh /* from the createRammerhead funtion MUST be passed */, req, socket, head)
}
})
server.listen({host: '0.0.0.0', port: 8080}, () => {
console.log('Server is listening on port 8080!');
})
import rammerhead from '@rubynetwork/rammerhead';
const rh = rammerhead.createRammerhead({
logLevel: 'debug', //Options are: disabled, debug, traffic, info, warn, error (default: debug)
reverseProxy: false, //whether or not this server is running behind a reverse proxy (default: false)
disableLocalStorageSync: false, //disable localstorage sync (not recommended) (default: false)
disableHttp2: false //disable http2 usage (default: false) (NOT RECOMMENDED)
})
const server = http.createServer();
server.on('request', (req, res) => {
if (rammerhead.shouldRouteRh(req)) {
rammerhead.routeRhRequest(rh /* from the createRammerhead function MUST be passed */, req, res)
}
})
server.on('upgrade', (req, socket, head) => {
if (rammerhead.shouldRouteRh(req)) {
rammerhead.routeRhUpgrade(rh /* from the createRammerhead funtion MUST be passed */, req, socket, head)
}
})
server.listen({host: '0.0.0.0', port: 8080}, () => {
console.log('Server is listening on port 8080!');
})
import express from "express";
import { createServer } from "node:http";
import { createRammerhead, shouldRouteRh, routeRhUpgrade, routeRhRequest } from '@rubynetwork/rammerhead';
const app = express();
const server = createServer();
const rh = rammerhead.createRammerhead({
logLevel: 'debug', //Options are: disabled, debug, traffic, info, warn, error (default: debug)
reverseProxy: false, //whether or not this server is running behind a reverse proxy (default: false)
disableLocalStorageSync: false, //disable localstorage sync (not recommended) (default: false)
disableHttp2: false //disable http2 usage (default: false) (NOT RECOMMENDED)
})
server.on("request", (req, res) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
if (shouldRouteRh(req)) {
routeRhRequest(rh /* from the createRammerhead function MUST be passed */, req, res)
}
else {
app(req, res);
}
});
server.on("upgrade", (req, socket, head) => {
if (rammerhead.shouldRouteRh(req)) {
rammerhead.routeRhUpgrade(rh /* from the createRammerhead funtion MUST be passed */, req, socket, head)
}
else {
socket.end()
}
});
server.on("listening", () => {
console.log("Listening on: http://localhost:8080");
});
server.listen({port: 8080});
import Fastify from 'fastify';
import { createServer } from 'node:http';
import { createRammerhead, shouldRouteRh, routeRhUpgrade, routeRhRequest } from '@rubynetwork/rammerhead';
const rh = rammerhead.createRammerhead({
logLevel: 'debug', //Options are: disabled, debug, traffic, info, warn, error (default: debug)
reverseProxy: false, //whether or not this server is running behind a reverse proxy (default: false)
disableLocalStorageSync: false, //disable localstorage sync (not recommended) (default: false)
disableHttp2: false //disable http2 usage (default: false) (NOT RECOMMENDED)
})
const serverFactory = (handler) => {
return createServer()
.on('request', (req, res) => {
if (shouldRouteRh(req)) {
routeRhRequest(rh /* from the createRammerhead function MUST be passed */, req, res)
}
else {
handler(req, res);
}
})
.on('upgrade', (req, socket, head) => {
if (shouldRouteRh(req)) {
routeRhUpgrade(rh /* from the createRammerhead funtion MUST be passed */, req, socket, head)
}
});
};
const app = Fastify({ logger: false, serverFactory: serverFactory });
app.listen({ port: 8080, host: '0.0.0.0' });
console.log('Server is listening on: http://localhost:8080.');
FAQs
Easily use and run Rammerhead
The npm package @rubynetwork/rammerhead receives a total of 75 weekly downloads. As such, @rubynetwork/rammerhead popularity was classified as not popular.
We found that @rubynetwork/rammerhead demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.