百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vandium-node

> 编程语言
开源

AWS 使用 Node.js 构建函数的 Lambda 框架,适用于 API 网关、物联网应用程序和其他 AWS 事件。

384 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

AWS 使用 Node.js 构建函数的 Lambda 框架,适用于 API 网关、物联网应用程序和其他 AWS 事件。

AWS Lambda framework for building functions using Node.js for API Gateway, IoT applications, and other AWS events.

Features

  • Simplifies writing lambda handlers
  • Automatically verifies event types
  • Powerful input validation
  • Works with Serverless
  • JSON Web Token (JWT) verification and validation
  • JWK support for retrieving keys at startup
  • Automatic loading of environment variables from SSM Parameter Store
  • Cross Site Request Forgery (XSRF) detection when using JWT
  • SQL Injection (SQLi) detection and protection
  • Lambda Proxy Resource support for AWS API Gateway
  • Handler initialization for allocating resources
  • Post handler execution to allow deallocation of resources
  • Forces values into correct types
  • Handles uncaught exceptions
  • Promise support
  • Automatically trimmed strings for input event data
  • Low startup overhead
  • AWS Lambda Node.js 12.x

Installation

Install via npm.

bash
npm install vandium --save

Getting Started

Vandium creates event specific handlers to reduce the amount of code than one needs to maintain. The following handler code will respond with a message when executed using the AWS API Gateway with a GET request:

javascript
const vandium = require( 'vandium' );

// handler for an api gateway event
exports.handler = vandium.api()
		.GET( (event) => {

			// return greeting
			return 'Hello ' + event.pathParmeters.name + '!';
		});

The framework can process asynchronous responses using promises. The following code returns a User object from a datastore asynchronously:

javascript
const vandium = require( 'vandium' );

// our datastore access object
const Users = require( './users' );

// handler for an api gateway event
exports.handler = vandium.api()
		.GET()
		 	.validation({

				pathParmeters: {

					name: 'string:min=1,max=100,required'
				}
			})
			.handler( async (event) => {

				// returns a promise that resolves the User by name
				return await Users.getUser( event.pathParmeters.name );
			});

Additionally, resources can be closed at the end, success or failure, of the handler. Failure to close resources might cause the lambda function to timeout or run for longer than is required. The following code demonstrates closing a cache after the handler has been called:

javascript
const vandium = require( 'vandium' );

// our datastore access object
const Users = require( './users' );

// object caching - automatically connects on first access
const cache = require( './cache' );

// handler for an api gateway event
exports.handler = vandium.api()
		.GET((event) => {

			// returns a promise that resolves the User by name
			return Users.getUser( event.pathParmeters.name );
		})
		.finally( () => {

			// returns a promise that closes the cache connection
			return cache.close();
		});

Vandium supports the following types of AWS Lambda events:

  • API Gateway
  • Cloudformation
  • Cloudwatch
  • Cognito
  • Dynamodb
  • Kinesis
  • Alexa
  • S3
  • Scheduled
  • SES
  • SNS

Documentation

For documentation on how to use vandium in your project, please see our documentation page.

Feedback

We'd love to get feedback on how to make this tool better. Feel free to contact us at [email protected]

License

BSD-3-Clause

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptapi-gatewayaws-lambdaiotjwt

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言