You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-2Lines changed: 40 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Works with provider :
13
13
-[x]**Google Cloud Platform - Cloud functions**
14
14
-[ ] Microsoft Azure - Cloud functions | *in development*
15
15
16
-
## Installation
16
+
## Download
17
17
Type this command inside your terminal
18
18
```
19
19
npm install --save serverless-express
@@ -24,7 +24,7 @@ or for yarn users
24
24
yarn add serverless-express
25
25
```
26
26
27
-
## Usage
27
+
## Installation
28
28
29
29
### 1 - Add it to your serverless.yml
30
30
@@ -96,3 +96,41 @@ exports.handler = handler(app)
96
96
97
97
Now that everything is done, you can get back to work and enjoy serverless and express in the same time ;)
98
98
99
+
## Usage
100
+
Make sure that you register an HTTP event for each endpoint of your express app.
101
+
For example, if you register an endpoint like this one:
102
+
```js
103
+
app.get( '/users' , showUsers )
104
+
```
105
+
106
+
You will need to make sure that your cloud provider routes the HTTP call to your app. In order to do so, you will need to update your serverless.yml like so :
107
+
```yml
108
+
# like this
109
+
functions:
110
+
app:
111
+
handler: handler.handler #assuming your handler file is handler.js
112
+
events:
113
+
- http:
114
+
path: GET
115
+
method: /users
116
+
117
+
# or like this
118
+
# be careful, this will route every HTTP event to your function.
119
+
functions:
120
+
app:
121
+
handler: handler.handler
122
+
events:
123
+
- http:
124
+
path: /{proxy+}
125
+
method: ANY
126
+
```
127
+
128
+
129
+
130
+
131
+
132
+
133
+
### Todo
134
+
135
+
- [ ] create "serverless express yaml" command that updates the serverless.yml file with all the endpoints of the express app
0 commit comments