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: aws-node-express-api/README.md
+8-17
Original file line number
Diff line number
Diff line change
@@ -17,27 +17,19 @@ This template demonstrates how to develop and deploy a simple Node Express API s
17
17
18
18
## Anatomy of the template
19
19
20
-
This template configures a single function, `api`, which is responsible for handling all incoming requests thanks to configured `http` events. To learn more about `http` event configuration options, please refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/). As the events are configured in a way to accept all incoming requests, `express` framework is responsible for routing and handling requests internally. Implementation takes advantage of `serverless-http` package, which allows you to wrap existing `express` applications. To learn more about `serverless-http`, please refer to corresponding [GitHub repository](https://github.com/dougmoscrop/serverless-http).
20
+
This template configures a single function, `api`, which is responsible for handling all incoming requests thanks to the `httpApi` event. To learn more about `httpApi` event configuration options, please refer to [httpApi event docs](https://www.serverless.com/framework/docs/providers/aws/events/http-api/). As the event is configured in a way to accept all incoming requests, `express` framework is responsible for routing and handling requests internally. Implementation takes advantage of `serverless-http` package, which allows you to wrap existing `express` applications. To learn more about `serverless-http`, please refer to corresponding [GitHub repository](https://github.com/dougmoscrop/serverless-http).
21
21
22
22
## Usage
23
23
24
24
### Deployment
25
25
26
-
This example is made to work with the Serverless Framework dashboard, which includes advanced features such as CI/CD, monitoring, metrics, etc.
27
-
28
-
In order to deploy with dashboard, you need to first login with:
29
-
30
-
```
31
-
serverless login
32
-
```
33
-
34
-
install dependencies with:
26
+
Install dependencies with:
35
27
36
28
```
37
29
npm install
38
30
```
39
31
40
-
and then perform deployment with:
32
+
and then deploy with:
41
33
42
34
```
43
35
serverless deploy
@@ -69,22 +61,21 @@ resources: 12
69
61
api keys:
70
62
None
71
63
endpoints:
72
-
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/
73
-
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/{proxy+}
64
+
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/
74
65
functions:
75
66
api: aws-node-express-api-dev-api
76
67
layers:
77
68
None
78
69
```
79
70
80
-
_Note_: In current form, after deployment, your API is public and can be invoked by anyone. For production deployments, you might want to configure an authorizer. For details on how to do that, refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/).
71
+
_Note_: In current form, after deployment, your API is public and can be invoked by anyone. For production deployments, you might want to configure an authorizer. For details on how to do that, refer to [`httpApi` event docs](https://www.serverless.com/framework/docs/providers/aws/events/http-api/).
81
72
82
73
### Invocation
83
74
84
75
After successful deployment, you can call the created application via HTTP:
Copy file name to clipboardExpand all lines: aws-node-express-dynamodb-api/README.md
+8-17
Original file line number
Diff line number
Diff line change
@@ -18,27 +18,19 @@ This template demonstrates how to develop and deploy a simple Node Express API s
18
18
19
19
## Anatomy of the template
20
20
21
-
This template configures a single function, `api`, in `serverless.yml`which is responsible for handling all incoming requests thanks to configured `http` events. To learn more about `http` event configuration options, please refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/). As the events are configured in a way to accept all incoming requests, `express` framework is responsible for routing and handling requests internally. Implementation takes advantage of `serverless-http` package, which allows you to wrap existing `express` applications. To learn more about `serverless-http`, please refer to corresponding [GitHub repository](https://github.com/dougmoscrop/serverless-http). Additionally, it also handles provisioning of a DynamoDB database that is used for storing data about users. The `express` application exposes two endpoints, `POST /users` and `GET /user/{userId}`, which allow to create and retrieve users.
21
+
This template configures a single function, `api`, which is responsible for handling all incoming requests thanks to the `httpApi` event. To learn more about `httpApi` event configuration options, please refer to [httpApi event docs](https://www.serverless.com/framework/docs/providers/aws/events/http-api/). As the event is configured in a way to accept all incoming requests, `express` framework is responsible for routing and handling requests internally. Implementation takes advantage of `serverless-http` package, which allows you to wrap existing `express` applications. To learn more about `serverless-http`, please refer to corresponding [GitHub repository](https://github.com/dougmoscrop/serverless-http). Additionally, it also handles provisioning of a DynamoDB database that is used for storing data about users. The `express` application exposes two endpoints, `POST /users` and `GET /user/{userId}`, which allow to create and retrieve users.
22
22
23
23
## Usage
24
24
25
25
### Deployment
26
26
27
-
This example is made to work with the Serverless Framework dashboard, which includes advanced features such as CI/CD, monitoring, metrics, etc.
28
-
29
-
In order to deploy with dashboard, you need to first login with:
30
-
31
-
```
32
-
serverless login
33
-
```
34
-
35
-
install dependencies with:
27
+
Install dependencies with:
36
28
37
29
```
38
30
npm install
39
31
```
40
32
41
-
and then perform deployment with:
33
+
and then deploy with:
42
34
43
35
```
44
36
serverless deploy
@@ -70,22 +62,21 @@ resources: 13
70
62
api keys:
71
63
None
72
64
endpoints:
73
-
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/
74
-
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/{proxy+}
65
+
ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/
75
66
functions:
76
67
api: aws-node-express-dynamodb-api-dev-api
77
68
layers:
78
69
None
79
70
```
80
71
81
-
_Note_: In current form, after deployment, your API is public and can be invoked by anyone. For production deployments, you might want to configure an authorizer. For details on how to do that, refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/). Additionally, in current configuration, DynamoDB Table will be removed when running `serverless remove`. To retain DynamoDB Table even after removal of the stack, add `DeletionPolicy: Retain` to its resource definition.
72
+
_Note_: In current form, after deployment, your API is public and can be invoked by anyone. For production deployments, you might want to configure an authorizer. For details on how to do that, refer to [`httpApi` event docs](https://www.serverless.com/framework/docs/providers/aws/events/http-api/). Additionally, in current configuration, the DynamoDB table will be removed when running `serverless remove`. To retain the DynamoDB table even after removal of the stack, add `DeletionPolicy: Retain` to its resource definition.
82
73
83
74
### Invocation
84
75
85
76
After successful deployment, you can create a new user by calling the corresponding endpoint:
@@ -114,7 +105,7 @@ If you try to retrieve user that does not exist, you should receive the followin
114
105
115
106
### Local development
116
107
117
-
It is also possible to emulate DynamodB, API Gateway and Lambda locally by using `serverless-dynamodb-local` and `serverless-offline` plugins. In order to do that, execute the following commands:
108
+
It is also possible to emulate DynamoDB, API Gateway and Lambda locally using the `serverless-dynamodb-local` and `serverless-offline` plugins. In order to do that, run:
title: 'AWS Serverless HTTP API with DynamoDB and offline support example in NodeJS'
3
+
description: 'This example demonstrates how to run a service locally, using the ''serverless-offline'' plugin. It provides an HTTP API to manage Todos stored in DynamoDB.'
[{"text":"Deploy my first service","id":"ac90feaa11e6-9ede-afdfa051af86","checked":true,"updatedAt":1479139961304},{"text":"Learn Serverless","id":"206793aa11e6-9ede-afdfa051af86","createdAt":1479139943241,"checked":false,"updatedAt":1479139943241}]%
65
+
```
66
+
67
+
### Get one Todo
68
+
69
+
```bash
70
+
# Replace the <id> part with a real id from your todos table
0 commit comments