Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
twilio-run
Advanced tools
twilio-run
☁️ CLI tool to run Twilio Functions locally for development
You can install the CLI tool via npm
or another package manager. Ideally install it as a dev dependency instead of global:
# Install it as a dev dependency
$ npm install twilio-run --save-dev
# Afterwards you can use by using:
$ node_modules/.bin/twilio-run
$ npx twilio-run
# Or inside your package.json scripts section as "twilio-run"
CLI tool to run Twilio Functions locally for development
Usage
$ twilio-run [dir]
Options
--env, -e [/path/to/.env] Loads .env file
--port, -p <port> Override default port of 3000
Examples
$ twilio-run
# Serves all functions in current functions sub directory
$ twilio-run demo
# Serves all functions in demo/functions
$ PORT=9000 twilio-run
# Serves functions on port 9000
$ twilio-run --port=4200
# Serves functions on port 4200
$ twilio-run --env
# Loads environment variables from .env file
The module also exposes two functions that you can use outside of the CLI tool:
runDevServer(port: number, baseDir: string)
This allows you to trigger running an express server that will expose all functions and assets. Example:
const { runDevServer } = require('twilio-run');
runDevServer(9000)
.then(app => {
console.log(`Server is running on port ${app.get('port')})`);
})
.catch(err => {
console.error('Something failed');
});
handleToExpressRoute(functionHandle: Function)
You can take the handler
function of a Twilio Function file and expose it in an existing Express server. Example:
const express = require('express');
const bodyParser = require('body-parser');
const { handlerToExpressRoute } = require('twilio-run');
const { handler } = require('./path/to/function.js');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.all(handlerToExpressRoute(handler));
app.listen(3000, () => console.log('Server running on port 3000'));
💖 Please be aware that this project has a Code of Conduct 💖
$ git clone git@github.com:dkundel/twilio-run.git
$ cd twilio-run
$ npm install
$ npm test
Thanks goes to these wonderful people (emoji key):
Dominik Kundel 💻 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
CLI tool to run Twilio Functions locally for development
The npm package twilio-run receives a total of 2,686 weekly downloads. As such, twilio-run popularity was classified as popular.
We found that twilio-run demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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 found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.