Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
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)
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 forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.