
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
ts-lambda-local-dev
Advanced tools
During aws lambda api development, either fronted by api-gateway or ALB, one issue is local development because lambda is a aws managed run time. Tools like SAM can do that but requires docker and not that flexible in terms of watch file change etc. Also it is kind of heavy due to the other functionality it has(CloudFormation etc...).
The goal of this package is to create a simple server that proxies http request to the your nodejs Lambda handler
function. Also we all the the benefit of Typescript, so we can optionally add watch function which will reload server after change saved.
npm install ts-lambda-local-dev -D
Add below file as something like local.server.ts
in your project and run with ts-node
.
import { LocalLambda, LocalLambdaConfig } from 'ts-lambda-local-dev';
// assume your Lambda entry point is `handler()` inside `index.ts`
import { handler } from './index'
// context is provided as optional field in config.
const config: LocalLambdaConfig = {
handler: handler, // if type is not compatible, do `handler: handler as any`
port: 8000, // optional, default to 8000
}
const localLambda = new LocalLambda(config);
localLambda.run();
CORS
is enabled by default, you can pass in enableCORS: false
to disable it.
binaryContentTypesOverride
is also enabled by default, you can pass in binaryContentTypesOverride: []
to disable it or pass in your own list of content types that should be treated as binary content.
This package included ts-node-dev
as a dependency which would watch file change and use the ts-node compilation result to trigger reload. See the sample configurations in the example/
directory of this repo for more details.
assume your local.server.ts
is in src/
. include below config in your .vscode/launch.json
.
{
"version": "1.0.0",
"configurations": [
{
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"name": "Local Server",
"restart": true,
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-node-dev",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"runtimeArgs": [
"--respawn"
],
"args": [
"${workspaceFolder}/src/local.server.ts"
]
}
]
}
in your Run/Debug Configuration, add a node.js config with below params:
JavaScript file ---> node_modules/ts-node-dev/lib/bin.js
Application parameters ---> --respawn -- src/script/local.server.ts
FAQs
typescript lambda local development server
The npm package ts-lambda-local-dev receives a total of 1,043 weekly downloads. As such, ts-lambda-local-dev popularity was classified as popular.
We found that ts-lambda-local-dev 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.