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
http is a Rust project that implements an AWS Lambda function in Rust.
3
+
This lambda is responsible for providing the HTTP API for Docbox
4
4
5
5
## Prerequisites
6
6
@@ -12,46 +12,3 @@ http is a Rust project that implements an AWS Lambda function in Rust.
12
12
To build the project for production, run `cargo lambda build --release`. Remove the `--release` flag to build for development.
13
13
14
14
Read more about building your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/build.html).
15
-
16
-
## Testing
17
-
18
-
You can run regular Rust unit tests with `cargo test`.
19
-
20
-
If you want to run integration tests locally, you can use the `cargo lambda watch` and `cargo lambda invoke` commands to do it.
21
-
22
-
First, run `cargo lambda watch` to start a local server. When you make changes to the code, the server will automatically restart.
23
-
24
-
Second, you'll need a way to pass the event data to the lambda function.
25
-
26
-
You can use the existent [event payloads](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) in the Rust Runtime repository if your lambda function is using one of the supported event types.
27
-
28
-
You can use those examples directly with the `--data-example` flag, where the value is the name of the file in the [lambda-events](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) repository without the `example_` prefix and the `.json` extension.
29
-
30
-
```bash
31
-
cargo lambda invoke --data-example apigw-request
32
-
```
33
-
34
-
For generic events, where you define the event data structure, you can create a JSON file with the data you want to test with. For example:
35
-
36
-
```json
37
-
{
38
-
"command": "test"
39
-
}
40
-
```
41
-
42
-
Then, run `cargo lambda invoke --data-file ./data.json` to invoke the function with the data in `data.json`.
43
-
44
-
For HTTP events, you can also call the function directly with cURL or any other HTTP client. For example:
45
-
46
-
```bash
47
-
curl https://localhost:9000
48
-
```
49
-
50
-
Read more about running the local server in [the Cargo Lambda documentation for the `watch` command](https://www.cargo-lambda.info/commands/watch.html).
51
-
Read more about invoking the function in [the Cargo Lambda documentation for the `invoke` command](https://www.cargo-lambda.info/commands/invoke.html).
52
-
53
-
## Deploying
54
-
55
-
To deploy the project, run `cargo lambda deploy`. This will create an IAM role and a Lambda function in your AWS account.
56
-
57
-
Read more about deploying your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/deploy.html).
To build the project for production, run `cargo lambda build --release`. Remove the `--release` flag to build for development.
14
20
15
21
Read more about building your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/build.html).
16
-
17
-
## Testing
18
-
19
-
You can run regular Rust unit tests with `cargo test`.
20
-
21
-
If you want to run integration tests locally, you can use the `cargo lambda watch` and `cargo lambda invoke` commands to do it.
22
-
23
-
First, run `cargo lambda watch` to start a local server. When you make changes to the code, the server will automatically restart.
24
-
25
-
Second, you'll need a way to pass the event data to the lambda function.
26
-
27
-
You can use the existent [event payloads](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) in the Rust Runtime repository if your lambda function is using one of the supported event types.
28
-
29
-
You can use those examples directly with the `--data-example` flag, where the value is the name of the file in the [lambda-events](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) repository without the `example_` prefix and the `.json` extension.
30
-
31
-
```bash
32
-
cargo lambda invoke --data-example apigw-request
33
-
```
34
-
35
-
For generic events, where you define the event data structure, you can create a JSON file with the data you want to test with. For example:
36
-
37
-
```json
38
-
{
39
-
"command": "test"
40
-
}
41
-
```
42
-
43
-
Then, run `cargo lambda invoke --data-file ./data.json` to invoke the function with the data in `data.json`.
44
-
45
-
Read more about running the local server in [the Cargo Lambda documentation for the `watch` command](https://www.cargo-lambda.info/commands/watch.html).
46
-
Read more about invoking the function in [the Cargo Lambda documentation for the `invoke` command](https://www.cargo-lambda.info/commands/invoke.html).
47
-
48
-
## Deploying
49
-
50
-
To deploy the project, run `cargo lambda deploy`. This will create an IAM role and a Lambda function in your AWS account.
51
-
52
-
Read more about deploying your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/deploy.html).
To build the project for production, run `cargo lambda build --release`. Remove the `--release` flag to build for development.
14
18
15
19
Read more about building your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/build.html).
16
-
17
-
## Testing
18
-
19
-
You can run regular Rust unit tests with `cargo test`.
20
-
21
-
If you want to run integration tests locally, you can use the `cargo lambda watch` and `cargo lambda invoke` commands to do it.
22
-
23
-
First, run `cargo lambda watch` to start a local server. When you make changes to the code, the server will automatically restart.
24
-
25
-
Second, you'll need a way to pass the event data to the lambda function.
26
-
27
-
You can use the existent [event payloads](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) in the Rust Runtime repository if your lambda function is using one of the supported event types.
28
-
29
-
You can use those examples directly with the `--data-example` flag, where the value is the name of the file in the [lambda-events](https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events/src/fixtures) repository without the `example_` prefix and the `.json` extension.
30
-
31
-
```bash
32
-
cargo lambda invoke --data-example apigw-request
33
-
```
34
-
35
-
For generic events, where you define the event data structure, you can create a JSON file with the data you want to test with. For example:
36
-
37
-
```json
38
-
{
39
-
"command": "test"
40
-
}
41
-
```
42
-
43
-
Then, run `cargo lambda invoke --data-file ./data.json` to invoke the function with the data in `data.json`.
44
-
45
-
Read more about running the local server in [the Cargo Lambda documentation for the `watch` command](https://www.cargo-lambda.info/commands/watch.html).
46
-
Read more about invoking the function in [the Cargo Lambda documentation for the `invoke` command](https://www.cargo-lambda.info/commands/invoke.html).
47
-
48
-
## Deploying
49
-
50
-
To deploy the project, run `cargo lambda deploy`. This will create an IAM role and a Lambda function in your AWS account.
51
-
52
-
Read more about deploying your lambda function in [the Cargo Lambda documentation](https://www.cargo-lambda.info/commands/deploy.html).
0 commit comments