https://github.com/web-seven/serverless-offline-express
Serverless plugin for run functions offline using Express server
https://github.com/web-seven/serverless-offline-express
expressjs firebase-functions google-cloud-functions serverless serverless-offline
Last synced: 8 months ago
JSON representation
Serverless plugin for run functions offline using Express server
- Host: GitHub
- URL: https://github.com/web-seven/serverless-offline-express
- Owner: web-seven
- License: mit
- Created: 2019-07-19T11:32:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-16T13:57:53.000Z (over 6 years ago)
- Last Synced: 2024-04-28T11:39:55.556Z (almost 2 years ago)
- Topics: expressjs, firebase-functions, google-cloud-functions, serverless, serverless-offline
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless Offline Express
[](http://www.serverless.com)
[](https://opensource.org/licenses/MIT)
A Serverless v1.x plugin to run HTTP and PubSub functions with [Express](https://github.com/expressjs/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](https://firebase.google.com/docs/reference/functions/functions.pubsub.Message) interface for PubSub functions
## Install
```bash
$ npm install serverless-offline-express --save-dev
```
Add the plugin to your `serverless.yml` file:
```yaml
plugins:
- serverless-offline-express
```
## Configure
Plugin not support yet any configuration.
## Configure function
```yaml
# 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
```bash
$ serverless express
```
## Environment variables
* **EXPRESS_HOST** - Host name where Express will start
* **EXPRESS_PORT** - Port where Express will start