serverless-offline-express
v0.4.3
Published
Start Serverless handlers offline using Express
Downloads
6
Maintainers
Readme
Serverless Offline Express
A Serverless v1.x plugin to run HTTP and PubSub functions with Express.
This plugin is for you if you want to run offline multiple NodeJS/TypeScript functions, which use request and response Express framework.
Some of serverless services like Google Gloud Functions or Firebase Function use standard Express requests and response on HTTP function invocation, and this plugin allow to run them together offline and keep compatible develoment all Express based functions.
Highlights
- Configuration possibilities range from zero-config
- Combine in same running Express process all HTTP and PubSub handlers
- Support TypeScript functions execution
- Express 4 support
- Support NPM and Yarn for packaging
- Hot Module Reload support
- Emulate Message interface for PubSub functions
Install
$ npm install serverless-offline-express --save-dev
Add the plugin to your serverless.yml
file:
plugins:
- serverless-offline-express
Configure
Plugin not support yet any configuration.
Configure function
# serverless.yml
# Accessible by URL: /myFunction
functions:
myFunction:
handler: handlers/myHandlerFile.myFunctionName
events:
- http:
path: myHttpUrlPath
method: GET|PUT|POST|DELETE
# Accessible by URL: /pubsub/myPubSubMessageTopic?message={"name":"test"}&attributes[name]=test_attribute
myPubSubFunction:
handler: handlers/anotherHandlerFile.myPubSubFunctionName
events:
- pubsub:
topic: myPubSubMessageTopic
Run Express server
$ serverless express
Environment variables
- EXPRESS_HOST - Host name where Express will start
- EXPRESS_PORT - Port where Express will start