-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
379 lines (347 loc) · 13.4 KB
/
index.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<!DOCTYPE html>
<html lang="en">
<head>
<!-- meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" -->
<!-- BEGIN TRACKJS -->
<script type="text/javascript">window._trackJs = { token: '1a1b18828ed64fbb93f2552a8be07d3b' };</script>
<script type="text/javascript" src="//cdn.trackjs.com/releases/current/tracker.js"></script>
<!-- END TRACKJS -->
<title>JavaScript BaaS Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@import url(//fonts.googleapis.com/earlyaccess/notosanskr.css);
:lang(ko) { font-family: 'Noto Sans KR', sans-serif; }
</style>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style>
/* Remove the navbar's default margin-bottom and rounded borders */
.navbar {
margin-bottom: 0;
border-radius: 0;
}
/* Add a gray background color and some padding to the footer */
footer {
background-color: #f2f2f2;
padding: 25px;
}
.carousel-inner img {
width: 100%; /* Set width to 100% */
margin: auto;
min-height:50px;
}
/* Hide the carousel text when the screen is less than 600 pixels wide */
@media (max-width: 600px) {
.carousel-caption {
display: none;
}
}
body {
font-size: 16px;
}
</style>
</head>
<body lang="ko">
<center><div id="realssp_imyaman00001_7917" class="realssp_dv" data-mcode="aW15YW1hbjAwMDAxXzc5MTc="></div><script src="//nw.realssp.co.kr/realclickssp.js?v=1.0&m=imyaman00001_7917&t=j" async></script></center>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">YOU'RE SPACE</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">YOUR E-SPACE</a></li>
<li><a href="http://weblog.youre.space/">WEBLOG</a></li>
<li><a href="http://highest.youre.space/">Perl API</a></li>
<li><a href="http://lego.youre.space/">Lego</a></li>
<li><a href="http://fnb.youre.space/">F & B</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</div>
</nav>
<div id="mainpage">
<h1>JavaScript를 이용한 BaaS 예제</h1>
<h2>이게 뭔가요?</h2>
<p>BaaS(Backend as a Service)를 잘 쓰자는 취지에서 JavaScript 예제를 만들어보았습니다. 초보자를 위해 가능한 단순하게 만들었습니다.<br>
근래 많은 BaaS가 사라지고 새로운 것이 나오고 있습니다. 많은 관심 부탁드립니다.<br>
특히 <a href="http://www.parse.com">Parse</a>가 서비스를 종료하게 되며, 그 오픈 소스 소프트웨어인 <a href="https://parseplatform.github.io/">Parse Server</a>를 이용한 제3의 서비스가 있습니다.</p>
<h2><a href="http://firebase.google.com">Firebase</a> 예제</h2>
<ul>
<li><a href="firebase/index.html" rel="external">댓글보기</a></li>
<li><a href="firebase/write.html" rel="external">댓글쓰기</a></li>
</ul>
<pre class="prettyprint">
var config = {
apiKey: "AIzaSyDMRNixCXgWuD3z1P2f_hlM3LqxJry5Rks",
authDomain: "blog-c227a.firebaseapp.com",
databaseURL: "https://blog-c227a.firebaseio.com",
storageBucket: "blog-c227a.appspot.com",
};
firebase.initializeApp(config);
firebase.database().ref('/comments/').limitToLast(5).once('value').then(function(snapshot) {
console.log(snapshot.val());
drawCommentsTable(snapshot.val());
// $.each(results, function(index, value){ ...
// row.append($("<td>" + value.comment + "</td>"));
currentPage++;
});
</pre>
<h2><a href="https://api02.youre.space/svr42mp/baas.io/users">youre.space usergrid</a> 예제</h2>
<ul>
<li><a href="usergrid" rel="external">단순조회</a>
<li><a href="usergrid/index2.html" rel="external">조회+더보기</a></li>
<li><a href="usergrid/write.html" rel="external">쓰기</a></li>
</ul>
데이터를 조회하는 부분. usergrid와 baas.io는 서로 비슷합니다.
<pre class="prettyprint">
<script src="js/usergrid.js"></script>
<script>
$(document).ready(function() {
var client = new Usergrid.Client({
'URI':'https://api02.youre.space',
'orgName':'svr42mp',
'appName':'baas.io',
//'token':baas_token
});
var options = {
'client':client,
'endpoint':'comments',
'qs':{
'ql':'order by created DESC'
}
}
client.request(options, function (err, data) {
if(!err){
drawCommentsTable(data.entities);
}else{
console.log(err.toString());
}
});
}
</pre>
<h2>kt <a href="http://baas.io">baas.io</a> 예제</h2>
<ul>
<li><a href="baas.io" rel="external">단순조회</a>
<li><a href="baas.io/index2.html" rel="external">조회+더보기</a></li>
<li><a href="baas.io/write.html" rel="external">쓰기</a></li>
</ul>
데이터를 조회하는 부분
<pre class="prettyprint">
var io = new Baas.IO({
'URI':'https://api.baas.io',
'orgName':'imyaman',
'appName':'b-log',
});
var options = {
'client':io,
'endpoint':'comments',
'qs':{
'ql':'order by created DESC'
}
}
io.request(options, function (err, data) {
if(!err){
}else{
}
});
</pre>
<h2><a href="http://parse.com">Parse</a> 예제</h2>
<ul>
<li><a href="parse" rel="external">단순조회</a></li>
<li><a href="parse/index2.html" rel="external"></a></li>
<li><a href="parse/write.html" rel="external"></a></li>
</ul>
<pre class="prettyprint">
Parse.initialize('cdzz7YuYMPaopERtDOd15bUvv7oSaFtJYkCNZjIg', 'cPEU1ggQqkfL1Uh2fPekOWsmrCs7xc39H6RKZRpr');
var query = new Parse.Query('Comments');
query.limit(10);
query.find({
success: drawCommentsTable,
error: drawCommentsError
});
</pre>
<h2><a href="http://parse.com">Parse Server</a> 예제</h2>
<ul>
<li><a href="parse-server/index.html" rel="external">댓글보기</a></li>
<li><a href="parse-server/write.html" rel="external">댓글쓰기</a></li>
</ul>
<pre class="prettyprint">
Parse.initialize('cdzz7YuYMPaopERtDOd15bUvv7oSaFtJYkCNZjIg', 'cPEU1ggQqkfL1Uh2fPekOWsmrCs7xc39H6RKZRpr');
Parse.serverURL = 'http://jts.youre.space:1337/parse'
var query = new Parse.Query('Comments');
query.skip(pgCount*currentPage);
query.limit(pgCount);
query.descending("createdAt");
query.find({
success: drawCommentsTable,
error: drawCommentsError
});
currentPage++;
</pre>
<h2><a href="http://parse.buddy.com">Buddy - Parse Server</a> 예제</h2>
<ul>
<li><a href="parsebuddy/index.html" rel="external">댓글보기</a></li>
<li><a href="parsebuddy/write.html" rel="external">댓글쓰기</a></li>
</ul>
<pre class="prettyprint">
Parse.initialize('***********', '**********');
Parse.serverURL = 'http://parse.buddy.com/parse'
var query = new Parse.Query('Comments');
query.skip(pgCount*currentPage);
query.limit(pgCount);
query.descending("createdAt");
query.find({
success: drawCommentsTable,
error: drawCommentsError
});
currentPage++;
</pre>
<h2><a href="http://kinvey.com">Kinvey</a> 예제</h2>
<ul>
<li><a href="kinvey" rel="external">단순조회</a></li>
<li><a href="kinvey/index2.html" rel="external"></a></li>
<li><a href="kinvey/write.html" rel="external"></a></li>
</ul>
<pre class="prettyprint">
var promise = Kinvey.init({
appKey : 'kid_WkVVFh1N5',
appSecret : '8ffb767dda014827bd9de4ea01df7a32'
});
promise.then(function(activeUser) {
if(null === activeUser) {
return Kinvey.User.create();
}
}, function(error) {
});
var promise = Kinvey.DataStore.find('Comments', null, {
success : drawCommentsTable,
error : drawCommentsError
});
</pre>
<h2>Microsoft <a href="http://azure.com">Azure Mobile Services</a> 예제</h2>
<ul>
<li><a href="azure" rel="external">단순조회</a></li>
<li><a href="azure/index2.html" rel="external"></a></li>
<li><a href="azure/write.html" rel="external"></a></li>
</ul>
<pre class="prettyprint">
var client = new WindowsAzure.MobileServiceClient('https://nextlayer.azure-mobile.net/', 'tIBCRAuvMqKAojuCYMmbqUdLzKSrNw70');
var commentsItemTable = client.getTable('Comments');
commentsItemTable.systemProperties = WindowsAzure.MobileServiceTable.SystemProperties.All;
var query = commentsItemTable.where({ });
query.read().then(function(commentsItems) {
var listItems = $.map(commentsItems, function(item){
});
$('#commentsTable').empty().append(listItems).toggle(listItems.length > 0);
}, handleError);
</pre>
<p>Azure Mobile Services 예제 새로 만든 것 <a href="azurenew">여기</a></p>
<h2>SKTelecom <a href="http://developer.sktelecom.com">T developers</a> BaaS 예제</h2>
<ul>
<li><a href="sktdevbaas" rel="external">단순조회</a></li>
<li><a href="sktdevbaas/index2.html" rel="external">조회+더보기</a></li>
<li><a href="sktdevbaas/write.html" rel="external">쓰기</a></li>
</ul>
<pre class="prettyprint">
Baas.initialize("7dab9da0-9541-4c63-9c6a-452c02ba957a");
var query = new Baas.Query('Comments');
query.limit(10);
query.find({
success: drawCommentsTable,
error: drawCommentsError
});
</pre>
<h2>설명</h2>
<p>우선 SKT의 T developers에서 제공하는 BaaS의 예시로 설명<br />
<a href="http://1drv.ms/1JOFZAu" rel="external">여기</a></p>
<p>소스코드를 보라</p>
<p>속도는 baas.io, sktdevbaas, parse, kinvey 순</p>
<p>편리함은 baas.io, parse, sktdevbaas, kinvey 순</p>
<p>Microsoft의 Azure Mobile Services는 신세계. 대단함.</p>
<ul>
<li><a href="http://github.com/imyaman/MBaaS-SimpleExample" rel=external>README.md on github</a></li>
<li><a href="README.md" rel=external>README.md</a></li>
<li><a href="00-README-introduce.md" rel=external>00-README-introduce.md</a></li>
<li><a href="01-README-baas.io.md" rel=external>01-README-baas.io.md</a></li>
<li><a href="02-README-parse.md" rel=external>02-README-parse.md</a></li>
<li><a href="03-README-kinvey.md" rel=external>03-README-kinvey.md</a></li>
<li><a href="04-README-azure.md" rel=external>04-README-azure.md</a></li>
<li><a href="05-README-sktdevbaas.md" rel=external>05-README-sktdevbaas.md</a></li>
</ul>
<div
class="fb-like"
data-share="true"
data-width="450"
data-show-faces="true">
</div>
</div> <!-- end of mainpage -->
<footer class="container-fluid text-center">
<p><a href="http://youre.space/">YOU'RE SPACE</a><br />
너의 공간
</p>
<center>
<script type="text/javascript">
//interstitial ad
clicksor_enable_inter = false; clicksor_maxad = -1; clicksor_hourcap = -1; clicksor_showcap = 2; clicksor_enable_adhere = false;
//default pop-under house ad url
clicksor_enable_pop = false; clicksor_frequencyCap = -1; durl = '';
clicksor_enable_layer_pop = false; clicksor_mobile_redirect = false;
//default banner house ad url
//clicksor_default_url = 'http://creative.clicksor.com/pub_default_ads/330835_1/1_562543_7_d.htm';
clicksor_banner_border = '#000000'; clicksor_banner_ad_bg = '#FFFFFF';
clicksor_banner_link_color = '#000000'; clicksor_banner_text_color = '#666666';
clicksor_banner_image_banner = true; clicksor_banner_text_banner = true;
clicksor_layer_border_color = '#000000';
clicksor_layer_ad_bg = '#FFFFFF'; clicksor_layer_ad_link_color = '#000000';
clicksor_layer_ad_text_color = '#666666'; clicksor_text_link_bg = '';
clicksor_text_link_color = ''; clicksor_enable_text_link = false;
clicksor_layer_banner = false;
</script>
<script type="text/javascript" src="http://b.yu0123456.com/show.php?nid=1&pid=330835&adtype=7&sid=562543" aync></script>
</center>
<br />
<center>
<script type="text/javascript" src="http://adddn.adotsolution.com/contents/sdk/js/tad.min.js"></script>
<div class="main_banner" id="main_banner">
<script type="text/javascript">
var tad_slot_conf = {
slotNo : 2, targetId : 'main_banner', clientId : 'MX00048A1', newWindow : true, test : false,
errorCallback : function(errorCode) {
if(errorCode == 0) { // No Ad. 에러 처리 및 다른 광고 플랫폼 호출
} else if(errorCode == 1) { // Frequency Over. 에러 처리 및 다른 광고 플랫폼 호출
}
}
};
TadSdk.AdView.init(tad_slot_conf);
</script>
</div>
</center>
<script type="text/javascript" src="http://scr.nsmartad.com/admixer/admixer.js"></script>
<script type="text/javascript">
new admixer_ad({
/* admixer_key:"8ch8bwvi", */
admixer_key:"zp1v4th5",
display_id:"admixer_display",
adsense_publisher_key:"ca-mb-pub-0000000000000000", //AdSense 사용시에만 필요
ad_change:false, //default : true
test:false, //default : false
test_display_id : "log"
});
</script>
<center> <div id="admixer_display"></div> <div id="log"></div> </center>
</footer>
<script src="//cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<!-- pre class="prettyprint"> </pre -->
<!-- script> // trackJs.track('ahoy trackjs!'); </script -->
</body>
</html>