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.
Social Media Photo by Jakub Gorajek on Unsplash
Express like routing, as Custom Element or standalone, inspired by page.js.
app.get(path:string|RegExp, cb:Function[, cb2, ...]):app
to subscribe one or more callbacks for the specified routeapp.delete(path:string|RegExp, cb:Function[, cb2, ...]):app
to unsubscribe one or more callbacks for the specified routeapp.navigate(path:string[, operation:string = 'push']):void
to navigate to the first matching route for the given path. By default, it pushes to the history but it could replace
, if the second parameter is the replace string, or ignore
.app.param(path:string|RegExp):app
to subscribe to a specific parameter regardless of the routeapp.use(path:string|RegExp):app
to subscribe a callback for a specific mount point or all of themThe following is a basic example, also available live.
<script src="//unpkg.com/a-route"></script>
<!-- simply add `is="a-route"` to any link in your page -->
<a is="a-route" href="/test/?query=value">test query</a>
<!-- you can also add `no-propagation`, to stop propagation on click
or you could add `replace` to replace state instead of pushing it -->
<a is="a-route" href="/test/OK" no-propagation replace>test OK</a>
<!-- unregistered routes will pass through `'*'` handler, if any -->
<a is="a-route" href="/whatever">test 404</a>
// import {app} from 'a-route';
// const {app} = require('a-route');
const {app} = ARoute;
// define routes
app
.get('/test/?query=:query', function (ctx) {
console.log(ctx);
/*
{
"path": "/test/?query=value",
"params": {
"query": "value"
}
}
*/
})
.get('/test/:status', function (ctx) {
console.log(ctx);
/*
{
"path": "/test/OK",
"params": {
"status": "OK"
}
}
*/
});
// intercept all unregistered calls
app.get('*',
function (ctx, next) {
console.log(ctx);
/*
{
"path": "/whatever"
}
*/
next();
},
// will receive the ctx object too
console.error
);
FAQs
Express like routing as Custom Element or standalone
The npm package a-route receives a total of 2 weekly downloads. As such, a-route popularity was classified as not popular.
We found that a-route 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.