-
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.
Quickly setting up the initial base project
- Loading branch information
0 parents
commit 0cd0d34
Showing
12 changed files
with
17,418 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,11 @@ | ||
*.js | ||
!jest.config.js | ||
*.d.ts | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
|
||
# Intellijerk | ||
.idea |
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,6 @@ | ||
*.ts | ||
!*.d.ts | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
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,29 @@ | ||
|
||
> This is a simple Agora token gen backend to be used with a front-end to use Agora services | ||
- Create an audio and video app using agora quick start guide | ||
- Add in call stats | ||
- add group chat | ||
- discuss how it works in detail | ||
- demonstrate how it runs. | ||
|
||
|
||
## Useful commands | ||
|
||
* `npm run build` compile typescript to js | ||
* `npm run watch` watch for changes and compile | ||
* `npm run test` perform the jest unit tests | ||
* `cdk deploy` deploy this stack to your default AWS account/region | ||
* `cdk diff` compare deployed stack with current state | ||
* `cdk synth` emits the synthesized CloudFormation template | ||
|
||
* `cdk --version` To get the current version of the CDK | ||
* `aws sts get-caller-identity --profile fff` to get the account number of the currently selected profile | ||
|
||
## To deploy: | ||
- `cd CDK/lambda` and then run `npm i` there | ||
- Run `cdk bootstrap --profile fff` // only run once, for the first time. | ||
- Run `cdk diff --profile fff` // to see the recent changes before deploying them. | ||
- Run `cdk deploy --profile fff` | ||
- Run `cdk deploy --hotswap --profile fff` For a fast re-deploy ( DON'T USE IN PRODUCTION! ) | ||
- Run `npm run watch` for continous hot-swap ( if needed edit `package.json` to include / exclude files in the watch ) |
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,6 @@ | ||
#!/usr/bin/env node | ||
import * as cdk from '@aws-cdk/core'; | ||
import { AgoraCdkStack } from '../lib/agora-cdk-stack'; | ||
|
||
const app = new cdk.App(); | ||
new AgoraCdkStack(app, 'argoStack'); |
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,18 @@ | ||
{ | ||
"app": "npx ts-node --prefer-ts-exts bin/agora-cdk.ts", | ||
"context": { | ||
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, | ||
"@aws-cdk/core:enableStackNameDuplicates": "true", | ||
"aws-cdk:enableDiffNoFail": "true", | ||
"@aws-cdk/core:stackRelativeExports": "true", | ||
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true, | ||
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true, | ||
"@aws-cdk/aws-kms:defaultKeyPolicies": true, | ||
"@aws-cdk/aws-s3:grantWriteWithoutAcl": true, | ||
"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true, | ||
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true, | ||
"@aws-cdk/aws-efs:defaultEncryptionAtRest": true, | ||
"@aws-cdk/aws-lambda:recognizeVersionProps": true, | ||
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": 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,8 @@ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/test'], | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest' | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
{ | ||
"name": "agora-cdk", | ||
"version": "1.0.0", | ||
"description": "This is the Lambda directory for the backend project", | ||
"main": "agoraGetToken.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "mim. Armand", | ||
"dependencies": { | ||
"uuid": "^8.3.2" | ||
} | ||
} |
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,32 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as lambda from '@aws-cdk/aws-lambda'; | ||
import * as apigw from '@aws-cdk/aws-apigateway'; | ||
|
||
export class AgoraCdkStack extends cdk.Stack { | ||
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { | ||
super(scope, id, props); | ||
|
||
const agoraGetToken = new lambda.Function(this, 'agoraGetToken', { | ||
runtime: lambda.Runtime.NODEJS_14_X, | ||
code: lambda.Code.fromAsset('lambda'), | ||
handler: 'agoraGetToken.handler', | ||
environment: { | ||
key: 'value' | ||
} | ||
}) | ||
|
||
const api = new apigw.RestApi(this, 'argoApis', { | ||
restApiName: "agora-cdk APIs", | ||
description: "APIs for the application." | ||
}) | ||
|
||
const getCalendarIntegration = new apigw.LambdaIntegration(agoraGetToken, { | ||
requestTemplates: { "application/json": '{"statusCode": "200"}'}, | ||
}) | ||
|
||
api.root.addMethod("GET", getCalendarIntegration, { | ||
operationName: "Get New Token", | ||
}) | ||
|
||
} | ||
} |
Oops, something went wrong.