Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.