-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackends.html
194 lines (169 loc) · 7.58 KB
/
backends.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html>
<title>Backends as a Service</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3-theme-blue-grey.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<style>
html,body,h1,h2,h3,h4,h5,h6 {font-family: "Roboto", sans-serif}
.w3-sidenav a,.w3-sidenav h4{padding:12px;}
.w3-navbar a{padding-top:12px !important;padding-bottom:12px !important;}
</style>
<body>
<!-- Navbar -->
<ul class="w3-navbar w3-theme w3-top w3-left-align w3-large" style="z-index:4;">
<li class="w3-opennav w3-right w3-hide-large">
<a class="w3-hover-white w3-large w3-theme-l1" href="javascript:void(0)" onclick="w3_open()"><i class="fa fa-bars"></i></a>
</li>
<li class="w3-hide-small"><a href="index.html" class="w3-hover-white">Home</a></li>
<li class="w3-hide-small"><a href="staticsites.html" class="w3-hover-white">Static Sites</a></li>
<li class="w3-hide-small"><a href="functions.html" class="w3-hover-white">Functions</a></li>
<li><a href="backends.html" class="w3-theme-l1">Backends</a></li>
<li class="w3-hide-medium w3-hide-small"><a href="contact.html" class="w3-hover-white">Contact</a></li>
</ul>
<!-- Sidenav -->
<nav class="w3-sidenav w3-collapse w3-theme-l5 w3-animate-left" style="z-index:3;width:250px;margin-top:51px;" id="mySidenav">
<a href="javascript:void(0)" onclick="w3_close()" class="w3-right w3-xlarge w3-padding-large w3-hover-black w3-hide-large" title="close menu">
<i class="fa fa-remove"></i>
</a>
<h4><b>Menu</b></h4>
<a href="index.html" class="w3-hover-black">Home</a>
<a href="staticsites.html" class="w3-hover-black">Static Sites</a>
<a href="functions.html" class="w3-hover-black">Functions</a>
<a href="backends.html" class="w3-hover-black">Backends</a>
<a href="contact.html" class="w3-hover-black">Contact</a>
</nav>
<!-- Overlay effect when opening sidenav on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>
<!-- Main content: shift it to the right by 250 pixels when the sidenav is visible -->
<div class="w3-main" style="margin-left:250px">
<div class="w3-row w3-padding-64">
<div class="w3-third w3-container">
<h1 class="w3-text-teal">Persistence</h1>
<p>Backends as a Service (BaaS) usually refers to persisting data in a data store of some sort. This could be a relational database, a graph database or other NoSQL store.</p>
<p>For web applications it's usually best to interact with these via a <a href="https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm">REST</a> API. You can find a <a href="http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#restful">good pragmatic introduction here</a></p>
<p>http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/getting-started.html</p>
<p>
<form name="theform">
Note: <input type="text" name="note"><br>
</form>
<h2 id="server-add-response">Result will appear here</h2>
<button type="button" onclick="ajaxCall('https://api.simplyserverless.com/notes','server-add-response','POST', theform)">Add Note</button>
<button type="button" onclick="ajaxCall('https://api.simplyserverless.com/notes','list-of-names-response','GET', null)">List Notes</button>
<button type="button" onclick="ajaxCall('https://api.simplyserverless.com/notes','server-add-response','DELETE', null)">Empty List</button>
</p>
</div>
<div class="w3-third w3-container w3-row w3-padding-64">
<p id="list-of-names-response">List of notes will appear here</p>
</div>
<div class="w3-third w3-container">
<p class="w3-border w3-padding-large w3-padding-32 w3-center">AD</p>
<p class="w3-border w3-padding-large w3-padding-64 w3-center">AD</p>
</div>
</div>
<div class="w3-row">
<div class="w3-twothird w3-container">
<h1 class="w3-text-teal">Auth</h1>
<p>Use:</p>
<code>
DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient(
new EnvironmentVariableCredentialsProvider()));
</code>
<p>
Instead of:
</p>
<code>
DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient(
new ProfileCredentialsProvider()));
</code>
<p>and ensure you set the Amazon Region appropriately:
</p>
<code>AmazonDynamoDBClient client = new AmazonDynamoDBClient(
new EnvironmentVariableCredentialsProvider());
client.setRegion(Region.getRegion(Regions.EU_WEST_1));
client.setSignerRegionOverride("eu-west-1");
DynamoDB dynamoDB = new DynamoDB(client);</code>
</div>
<div class="w3-third w3-container">
<p class="w3-border w3-padding-large w3-padding-32 w3-center">AD</p>
<p class="w3-border w3-padding-large w3-padding-64 w3-center">AD</p>
</div>
</div>
<!-- Pagination -->
<div class="w3-center w3-padding-64">
<ul class="w3-pagination">
<li><a class="w3-hover-black w3-hide-small" href="index.html">1</a></li>
<li><a class="w3-hover-black w3-hide-small" href="staticsites.html">2</a></li>
<li><a class="w3-hover-black" href="functions.html">3</a></li>
<li><a class="w3-black" href="backends.html">4</a></li>
<li><a class="w3-hover-black" href="contact.html">5</a></li>
</ul>
</div>
<footer id="myFooter">
<div class="w3-container w3-theme-l2 w3-padding-32">
<h4></h4>
</div>
<div class="w3-container w3-theme-l1">
<p>Powered by <a href="http://www.w3schools.com/w3css/default.asp" target="_blank">w3.css</a></p>
</div>
</footer>
<!-- END MAIN -->
</div>
<script>
// Get the Sidenav
var mySidenav = document.getElementById("mySidenav");
// Get the DIV with overlay effect
var overlayBg = document.getElementById("myOverlay");
// Toggle between showing and hiding the sidenav, and add overlay effect
function w3_open() {
if (mySidenav.style.display === 'block') {
mySidenav.style.display = 'none';
overlayBg.style.display = "none";
} else {
mySidenav.style.display = 'block';
overlayBg.style.display = "block";
}
}
// Close the sidenav with the close button
function w3_close() {
mySidenav.style.display = "none";
overlayBg.style.display = "none";
}
</script>
<script>
function ajaxCall(url, target, verb, data) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(target).innerHTML = this.responseText;
}
};
switch(verb) {
case "GET":
xhttp.open("GET", url, true);
xhttp.send();
break;
case "POST":
xhttp.open("POST", url, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(data);
break;
case "DELETE":
xhttp.open("DELETE", url, true);
xhttp.send();
break;
}
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-84008767-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>