-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vulcano
committed
Jul 15, 2023
0 parents
commit dc48398
Showing
12 changed files
with
11,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
root: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# package directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Serverless directories | ||
.serverless | ||
.build | ||
|
||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
title: 'AWS NodeJS Example' | ||
description: 'This template demonstrates how to deploy a NodeJS function running on AWS Lambda using the traditional Serverless Framework.' | ||
layout: Doc | ||
framework: v3 | ||
platform: AWS | ||
language: nodeJS | ||
priority: 1 | ||
authorLink: 'https://github.com/serverless' | ||
authorName: 'Serverless, inc.' | ||
authorAvatar: 'https://avatars1.githubusercontent.com/u/13742415?s=200&v=4' | ||
--> | ||
|
||
|
||
# Serverless Framework AWS NodeJS Example | ||
|
||
This template demonstrates how to deploy a NodeJS function running on AWS Lambda using the traditional Serverless Framework. The deployed function does not include any event definitions as well as any kind of persistence (database). For more advanced configurations check out the [examples repo](https://github.com/serverless/examples/) which includes integrations with SQS, DynamoDB or examples of functions that are triggered in `cron`-like manner. For details about configuration of specific `events`, please refer to our [documentation](https://www.serverless.com/framework/docs/providers/aws/events/). | ||
|
||
## Usage | ||
|
||
### Deployment | ||
|
||
In order to deploy the example, you need to run the following command: | ||
|
||
``` | ||
$ serverless deploy | ||
``` | ||
|
||
After running deploy, you should see output similar to: | ||
|
||
```bash | ||
Deploying aws-node-project to stage dev (us-east-1) | ||
|
||
✔ Service deployed to stack aws-node-project-dev (112s) | ||
|
||
functions: | ||
hello: aws-node-project-dev-hello (1.5 kB) | ||
``` | ||
|
||
### Invocation | ||
|
||
After successful deployment, you can invoke the deployed function by using the following command: | ||
|
||
```bash | ||
serverless invoke --function hello | ||
``` | ||
|
||
Which should result in response similar to the following: | ||
|
||
```json | ||
{ | ||
"statusCode": 200, | ||
"body": "{\n \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n \"input\": {}\n}" | ||
} | ||
``` | ||
|
||
### Local development | ||
|
||
You can invoke your function locally by using the following command: | ||
|
||
```bash | ||
serverless invoke local --function hello | ||
``` | ||
|
||
Which should result in response similar to the following: | ||
|
||
``` | ||
{ | ||
"statusCode": 200, | ||
"body": "{\n \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n \"input\": \"\"\n}" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
Oops, something went wrong.