
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A TypeScript based focus build library for Routing on AWS Lambda.
Npm:
npm install targety
Yarn:
yarn add targety
The quickest way to get started with Targety is by creating an EntryPoint and Handler.
Example Handler
import {
Get,
Handler,
Middleware,
Request,
Response,
ResponseBody
} from "targety";
export class ExampleHandler extends Handler {
protected middleware: Middleware[];
@Get("/test")
public async getTestMethod(request: Request): Promise<ResponseBody> {
return Response.ok(request).send({ test: "ok" });
}
}
The above example is the most basic implementation of a Handler (Router) with Targety.
For a more detailed implementation check the examples.
Example EntryPoint
import { Handler, LambdaEntryPoint } from "targety";
import { ExampleHandler } from "./Handler";
class ExampleEntryPoint extends LambdaEntryPoint {
protected async initializeHandler(): Promise<Handler> {
return new ExampleHandler();
}
}
const entryPoint = new ExampleEntryPoint();
// The exposed handler
export const handler = entryPoint.handle.bind(entryPoint);
The EntryPoint should create and expose the Handler. The general idea for the entry point,
is to allow you to setup services, connections, configuration, ... once that is then passed to
the constructor of the handler.
For a complete example see examples.
This is a list of hidden defaults and functionalities in the library that are good to know.
Whenever an error is throw that is "known" aka. a error available in the library errors this error will be mapped to the HTTP Status Code that it belongs too.
This is only when an error is thrown from a Handler class, for instance when a route fails. When an error is unknown and thrown this is returned as an internal server error, the logs will reflect this.
For instance throwing a error:
import { Error } from "targety";
// <snip>
throw new Error.UnauthorizedError("Unauthorized");
// </snip>
Will result in the error response by default as handeld in the Handler:
{
"message": "Unauthorized",
"errorCode": "Unauthorized",
"awsRequestId": "f9d04c1c-794f-44af-aeb0-65c6ef907ff1"
}
The AWS Request Id is the actual AWS Request Id that you could use for finding the corresponding logs.
Every response will get a set of Default Headers these can be overwritten and are defined in the library here
By default the AWS Request ID is returned as a header X-AWS-Request-Id
The library does use pino for it's logging capabilities, this will be configurable in a later version.
To enable logging export the environment variable LOG_LEVEL.
Other interesting and relevant links.
Docs for the latest build can be found here:
Written docs contain additional details on usage, examples, ...
The project contains an example in the examples directory. This is a working example that can be deployed on AWS if desired.
More examples might be added to further explain functionality.
The build in class validation is just a wrapper around class-validator I recommend checking out there documentation.
FAQs
AWS routing library for AWS Lambda, routing straight to your target
The npm package targety receives a total of 56 weekly downloads. As such, targety popularity was classified as not popular.
We found that targety 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.