
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
lark-router
Advanced tools
Router for lark based on koa 2.0
$ npm install --save lark-router
Lark-Router is a flexible and easy-to-use url router tool, compatible with native http apps, express apps and koa(v2) apps.
const router = new LarkRouter();
router.get('/foo/bar', (req, res) => res.end("/foo/bra requested!"));
router.on('error', (error, req, res) => {
res.statusCode = 500;
res.end(error.message);
});
http.createServer(router.routes()).listen(3000);
const router = new LarkRouter();
const app = new Koa();
router.get('/foo/bar', async (ctx, next) => {
ctx.body = '/foo/bar requested!';
await next();
});
router.on('error', (error, ctx, next) => {
ctx.statusCode = 500;
ctx.body = error.message;
return next();
});
app.use(router.routes()).listen(3000);
See path-to-regexp
. Params object is bind to the first argument of the app processor.
router.get('/:foo/:bar', (ctx, next) => { console.log(ctx.params); }); // ===> { foo: xxx, bar: xxx }
router.get(/^\/(\d+)\/(\w+)$/, (ctx, next) => { console.log(ctx.params); }); // ===> { 0: xxx, 1: xxx}
Lark router has 3 special methods.
router.all('/foo/bar', handler); // ===> response to GET/POST/DELETE/... /foo/bar
router.other('*', response404notfound); // ===> response to GET/POST/DELETE/... /foo/bar if no other route matched
router.routed('/foo/bar', () => console.log('/foo/bar has been routed')); // ===> response to GET/POST/DELETE/... /foo/bar if some routes matched
You could nest routers together:
mainRouter.all('/api', apiRouter);
For async processors, return promises.
router.get('/', () => new Promise(...));
router.get('/foo', async () => { ... });
FAQs
An koa route initialization and configuration module.
The npm package lark-router receives a total of 12 weekly downloads. As such, lark-router popularity was classified as not popular.
We found that lark-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.