
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
server-modules
Advanced tools
Easy configurable server modules (logging, express, api, websocket, mongodb)
This packages provides some easy-to-use utilities to setup a server with node.js.
import { ServerEnvironment } from 'server-modules';
// check /modules/logger/_interface.d.ts for additional options
const Server = new ServerEnvironment(
{
ident: 'Example-Server',
logger: {
console: {
level: 'silly'
},
file: {
path: './logs',
levels: ['info', 'warn', 'error']
}
}
}
);
const logger = Server.logger.spawn('my-module');
logger.info(`Logger created`);
Server
.createExpress({
port: 8080,
init: app => {
/*
* setup app
* this will be applied after
* cookieParser() / bodyParser.json() / compression() / morgan()
* the server will send a 404 status message if no route was found
*/
}
});
import { ApiSegment } from 'server-modules';
export const MyAPISegment = new ApiSegment('api');
MyAPISegment
.addRoute<{txt:string}>('echo/:txt')
.get((req, res) => {
const { params } = req;
res.send(params.txt);
});
Server
.createExpress({
port: 8081,
init: [MyAPISegment]
});
Server
.createExpress({
port: 8082,
init: app => {
MyAPISegment.registerOn(Server.logger, app);
}
});
Server
.createWebsocket(
{
port: 3001,
connection: MyWebsocketConnection
});
import { WebsocketConnection } from 'server-modules';
export class MyWebsocketConnection extends WebsocketConnection {
init() {
/* register event listeners */
this._socket.on('ping', () => {
this._socket.emit('pong');
});
}
}
const Client = Server.connectMongoDb({ auth });
Client.connect(db => {
/* work on database or save reference to db */
});
interface MongoDbConnectionCfg {
port?: number; // default: 27017
host?: string; // default: localhost
auth?: { // default: undefined
database?: string; // default: admin
user: string;
password: string;
};
options?: MongoClientOptions; // default: {}
}
FAQs
Easy configurable server modules (logging, express, api, websocket, mongodb)
The npm package server-modules receives a total of 13 weekly downloads. As such, server-modules popularity was classified as not popular.
We found that server-modules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.