Skip to content
This repository was archived by the owner on Feb 22, 2019. It is now read-only.

Commit f101a2a

Browse files
authored
Merge pull request #3 from serverless/example
Example
2 parents bda9534 + 4bc11be commit f101a2a

9 files changed

Lines changed: 966 additions & 27 deletions

File tree

.eslintrc.js

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
module.exports = {
22
root: true,
3-
extends: [
4-
'prettier',
5-
],
6-
plugins: [
7-
'import',
8-
'prettier',
9-
'sort-imports-es6-autofix'
10-
],
3+
extends: ['prettier'],
4+
plugins: ['import', 'prettier', 'sort-imports-es6-autofix'],
115
env: {
126
es6: true,
137
jest: true,
148
node: true
159
},
1610
parser: 'babel-eslint',
1711
parserOptions: {
18-
'ecmaVersion': 2018,
19-
'sourceType': 'module',
20-
'ecmaFeatures': {
21-
'jsx': true
12+
ecmaVersion: 2018,
13+
sourceType: 'module',
14+
ecmaFeatures: {
15+
jsx: true
2216
}
2317
},
2418
rules: {
@@ -31,12 +25,20 @@ module.exports = {
3125
}
3226
],
3327
'arrow-parens': ['error', 'always'],
34-
'arrow-spacing': ['error', { 'before': true, 'after': true }],
28+
'arrow-spacing': ['error', { before: true, after: true }],
3529
'comma-dangle': ['error', 'never'],
36-
'curly': 'error',
30+
curly: 'error',
3731
'eol-last': 'error',
3832
'func-names': 'off',
39-
'id-length': ['error', {'min': 2, 'max': 50, 'properties': 'never', 'exceptions': ['e', 'i', 'n', 't', 'x', 'y', 'z', '_', '$']}],
33+
'id-length': [
34+
'error',
35+
{
36+
min: 2,
37+
max: 50,
38+
properties: 'never',
39+
exceptions: ['e', 'i', 'n', 't', 'x', 'y', 'z', '_', '$']
40+
}
41+
],
4042
'no-alert': 'error',
4143
'no-console': 'error',
4244
'no-const-assign': 'error',
@@ -51,23 +53,26 @@ module.exports = {
5153
'object-curly-newline': 'off',
5254
'object-shorthand': 'off',
5355
'prefer-const': 'error',
54-
'prefer-destructuring': ['error', {'object': true, 'array': false}],
55-
'quotes': [
56+
'prefer-destructuring': ['error', { object: true, array: false }],
57+
quotes: [
5658
'error',
5759
'single',
5860
{
59-
'allowTemplateLiterals': true,
60-
'avoidEscape': true
61+
allowTemplateLiterals: true,
62+
avoidEscape: true
6163
}
6264
],
63-
'semi': ['error', 'never'],
65+
semi: ['error', 'never'],
6466
'spaced-comment': 'error',
65-
'strict': ['error', 'never'],
67+
strict: ['error', 'never'],
6668
'prettier/prettier': 'error',
67-
'sort-imports-es6-autofix/sort-imports-es6': ['error', {
68-
'ignoreCase': false,
69-
'ignoreMemberSort': false,
70-
'memberSyntaxSortOrder': ['none', 'all', 'multiple', 'single']
71-
}]
69+
'sort-imports-es6-autofix/sort-imports-es6': [
70+
'error',
71+
{
72+
ignoreCase: false,
73+
ignoreMemberSort: false,
74+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
75+
}
76+
]
7277
}
7378
}

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ CONTRIBUTING.md
7979
DEVELOPMENT.md
8080
RELEASE.md
8181
docs
82-
examples
82+
example
8383
scripts
8484
src

example/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# General
2+
3+
# Architecture
4+
5+
- API Gateway websockets
6+
- Lambda
7+
- DynamoDB
8+
- DynamoDB Streams (just to demo some durability)
9+
10+
# Chat Protocol
11+
12+
### Connect
13+
14+
`wscat -c wss://{ApiId}.execute-api.us-east-1.amazonaws.com/{ApiStage}`
15+
16+
### Messages
17+
18+
`{"action": "sendMessage", "name": "johndoe", "channelId": "General", "content": "hello world!"}`
19+
20+
### Channel Subscriptions
21+
22+
`{"action": "subscribeChannel", "channelId": "Secret"}`
23+
`{"action": "unsubscribeChannel", "channelId": "Secret"}`
24+
25+
### Get channel history
26+
27+
(coming soon)

0 commit comments

Comments
 (0)