
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
aws-lambda-event-router
Advanced tools
URL-like inside routing for AWS lambda.
const router = require("aws-lambda-event-router").createRouter();
router.get("/", (event, context, params) => {
context.succeed("welcome");
});
router.post("/books/:id", (event, context, params) => {
context.succeed("this is book " + params.id);
});
exports.handler = router;
Defining a router in lambda execution.
router.get("/", (event, context, params) => {
context.succeed("welcome");
});
The router
requires path
and httpMethod
in an event object. path
should be url-formed string. A minimum event object is:
{
"path" : "/",
"httpMethod" : "GET"
}
Finally, exports the router as handler:
exports.handler = router;
Then a response will be welcome
.
Now this library supports following methods.
To set a callback for a request, router.get
, router.post
, router.put
, router.delete
, router.head
, router.patch
, and router.options
are provided.
router.get("/", (event, context, params) => {
context.succeed("get");
});
router.post("/", (event, context, params) => {
context.succeed("post");
});
router.put("/", (event, context, params) => {
context.succeed("put");
});
router.delete("/", (event, context, params) => {
context.succeed("delete");
});
router.head("/", (event, context, params) => {
context.succeed("head");
});
router.patch("/", (event, context, params) => {
context.succeed("patch");
});
router.options("/", (event, context, params) => {
context.succeed("options");
});
/path/:param_name
style parameter is supported. You can access a parameter by req.params[param_name]
. For instance:
router.get("/books/:id", (event, context, params) => {
context.succeed("this is book " + params.id);
});
{
"path" : "/books/1",
"httpMethod" : "GET"
}
In this case, the response is this is book 1
.
A router imports sub-routers by use
method.
const router = Router.createRouter();
const subRouter = Router.createRouter();
subRouter.get("/hello", (event, context, params) => {
context.succeed("hello from sub router");
});
router.use("/sub", subRouter);
{
"path" : "/sub/hello",
"httpMethod" : "GET"
}
MIT
FAQs
routing inside lambda execution by event
The npm package aws-lambda-event-router receives a total of 2 weekly downloads. As such, aws-lambda-event-router popularity was classified as not popular.
We found that aws-lambda-event-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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.