forked from kayomarz/dynamodb-data-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamodb-data-types.html
94 lines (82 loc) · 1.88 KB
/
dynamodb-data-types.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!--
Since this HTML file loads dynamodb-data-types.min.js, you need to
run a web server. One easy way is to use python:
$ cd examples/browser/
$ python -m SimpleHTTPServer
Once the server is runnig, visit this url in your web browser:
http://localhost:8000/dynamodb-data-types.html
-->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>DynamoDB-data-types.js example</title>
<script src="dist/dynamodb-data-types.min.js"></script>
</head>
<body>
<header>
<h1>Using dynamodb-data-types.js in the browser.</h1>
</header>
<main>
<p>
<strong>DynamoDBDataTypes</strong> is available as a global variable.
</p>
<p>
Open your browser console and try it!
<pre>
var data = {
name: 'Java Script',
age: 18,
fav: {
food: ['Rice', 'Noodles'],
colors: ['Orange', 'Blue']
},
engines: [ 'Rhino', 'v8', 'SpiderMonkey', 'Carakan', 'JavaScriptCore' ]
};
var wrapped = DynamoDbDataTypes.AttributeValue.wrap(data);
JSON.stringify(wrapped, undefined, 2);
// {
// "name": {
// "S": "Java Script"
// },
// "age": {
// "N": "18"
// },
// "fav": {
// "M": {
// "food": {
// "SS": [
// "Rice",
// "Noodles"
// ]
// },
// "colors": {
// "SS": [
// "Orange",
// "Blue"
// ]
// }
// }
// },
// "engines": {
// "SS": [
// "Rhino",
// "v8",
// "SpiderMonkey",
// "Carakan",
// "JavaScriptCore"
// ]
// }
// }
</pre>
</p>
<p>
This example shows how to use dynamodb-datatypes.js in the browser.
To communicate with a live DynamoDB database, dont forget to include
<a href="https://aws.amazon.com/sdk-for-browser/">
https://aws.amazon.com/sdk-for-browser/
</a>
</p>
</main>
</body>
</html>