Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
socketio-file-router
Advanced tools
An express router that allows you to use the file system to create routes.
npm install socketio-file-router
You can integrate the file router by using it as a middleware like this:
await FileRouter(
io, // socket server
{
ROUTES_DIR: "/routes",
debug: false,
},
__dirname
);
import { createServer } from "http";
import { Server } from "socket.io";
import FileRouter from "socketio-file-router";
async function init(): Promise<void> {
process.on("uncaughtException", (err) => {
console.log(err);
});
const port = 3080;
const server = createServer();
const io = new Server(server, {
cors: {
origin: "*",
},
});
await FileRouter(
io,
{
ROUTES_DIR: "/routes",
debug: false,
},
__dirname
);
server.listen(port, () => console.log(`Server listening on port ${port}`));
}
init();
├── index.ts // main file
├── routes
├── get.ts // get
├── dynamic // params
├── param
├── [example].ts // single
└── [...slug].ts // get all
└── user
├── index.ts // user
└── post.ts
You are able to add route specific middlewares by exporting an array like this: Example
import { RequestHandler } from "socketio-file-router";
export const handler = [
async (socket, params, args, next) => {
if (!next) return;
return next({
nextParams: {
userID: "123",
},
});
},
async (socket, params, args) => {
console.log("middleware post", params, args);
},
] as RequestHandler[];
FAQs
An express router that allows you to use the file system to create routes.
The npm package socketio-file-router receives a total of 0 weekly downloads. As such, socketio-file-router popularity was classified as not popular.
We found that socketio-file-router 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.