Skip to content

Commit 840563d

Browse files
committed
updated examples according to a new version
1 parent 16c2048 commit 840563d

File tree

296 files changed

+1160
-1700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+1160
-1700
lines changed

angularjs-bootstrap/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

angularjs-bootstrap/views/_layout.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
@{ng('angular', 'resource', 'route')}
32

43
<!DOCTYPE html>

angularjs-common/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

angularjs-routing/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

angularjs-websocket/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

angularjs/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

assertion-testing/controllers/default.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exports.install = function(framework) {
22
framework.route('/1/', test1);
33
framework.route('/2/', test2);
4-
framework.route('/3/', test3);
4+
framework.route('/3/', test3, ['post', 'json']);
55
};
66

77
exports.functions = {
@@ -24,5 +24,6 @@ function test2() {
2424

2525
function test3() {
2626
// throw error
27-
this.plain('4');
27+
var self = this;
28+
self.json(self.body);
2829
}

assertion-testing/test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
1+
// ===================================================
2+
// IMPORTANT: only for testing
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
36

4-
framework.run(http, true, parseInt(process.argv[2]));
5-
framework.test();
7+
require('total.js').http('test');

assertion-testing/tests/default.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var assert = require('assert');
22

3-
exports.run = function(framework, name) {
3+
exports.run = function(framework) {
44

55
/**
66
* @see {@link http://docs.totaljs.com/Framework/#framework.assert|Documentation}
@@ -11,17 +11,17 @@ exports.run = function(framework, name) {
1111
next();
1212
});
1313

14-
framework.assert('Test URL 1', '/1/', ['GET'], function(error, data, code, headers, cookies, name) {
14+
framework.assert('Test URL 1', '/1/', ['get'], function(error, data, code, headers, cookies, name) {
1515
assert.ok(code === 200 && data === '1', name);
1616
});
1717

18-
framework.assert('Test URL 2', '/2/', ['GET'], function(error, data, code, headers, cookies, name) {
18+
framework.assert('Test URL 2', '/2/', ['get'], function(error, data, code, headers, cookies, name) {
1919
assert.ok(code === 200 && data === '2', name);
2020
});
2121

22-
framework.assert('Test URL 3', '/3/', ['GET'], function(error, data, code, headers, cookies, name) {
22+
framework.assert('Test URL 3', '/3/', ['post', 'json'], function(error, data, code, headers, cookies, name) {
2323
// throws error, data === 4
24-
assert.ok(code === 200 && data === '3', name);
25-
});
24+
assert.ok(code === 200 && JSON.parse(data).data === 3, name);
25+
}, { data: 4 });
2626

2727
};

async/controllers/default.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports.install = function(framework) {
55
function viewHomepage() {
66
var self = this;
77
var builder = [];
8-
8+
99
// Documentation: http://docs.totaljs.com/Async/
1010
self.await(function(complete) {
1111

@@ -20,7 +20,7 @@ function viewHomepage() {
2020
self.await(function(complete) {
2121

2222
// Documentation: http://docs.totaljs.com/FrameworkUtils/#utils.request
23-
utils.request('https://www.expressjs.com', 'GET', null, function(err, data) {
23+
utils.request('http://www.expressjs.com', 'GET', null, function(err, data) {
2424
var output = err ? 'error' : data.length.toString();
2525
builder.push('www.expressjs.com -> ' + output);
2626
complete();
@@ -46,7 +46,7 @@ function viewHomepage() {
4646
complete();
4747
});
4848
});
49-
49+
5050
// waiting for await('partial')
5151
self.wait('waiting 1', 'partial', function(complete) {
5252
console.log('waiting 1 complete');
@@ -61,7 +61,7 @@ function viewHomepage() {
6161
setTimeout(function() {
6262
complete();
6363
}, 1000);
64-
});
64+
});
6565

6666
/*
6767
self.complete(function() {

async/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

authorization-www-basic/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

authorization/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

bootstrap/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

bootstrap/views/homepage.html

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,36 @@
11
<div class="container">
2-
<div class="header">
3-
<ul class="nav nav-pills pull-right">
4-
<li class="active"><a href="#">Home</a></li>
5-
<li><a href="#">About</a></li>
6-
<li><a href="#">Contact</a></li>
7-
</ul>
8-
<h3 class="text-muted">Project name</h3>
9-
</div>
10-
11-
<div class="jumbotron">
12-
<h1>Jumbotron heading</h1>
13-
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
14-
<p><a class="btn btn-lg btn-success" href="#" role="button">Sign up today</a></p>
15-
</div>
16-
17-
<div class="row marketing">
18-
<div class="col-lg-6">
19-
<h4>Subheading</h4>
20-
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
21-
22-
<h4>Subheading</h4>
23-
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
24-
25-
<h4>Subheading</h4>
26-
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
2+
<div class="header">
3+
<ul class="nav nav-pills pull-right">
4+
<li class="active"><a href="#">Home</a></li>
5+
<li><a href="#">About</a></li>
6+
<li><a href="#">Contact</a></li>
7+
</ul>
8+
<h3 class="text-muted">Project name</h3>
279
</div>
28-
29-
<div class="col-lg-6">
30-
<h4>Subheading</h4>
31-
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
32-
33-
<h4>Subheading</h4>
34-
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
35-
36-
<h4>Subheading</h4>
37-
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
10+
<div class="jumbotron">
11+
<h1>Jumbotron heading</h1>
12+
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
13+
<p><a class="btn btn-lg btn-success" href="#" role="button">Sign up today</a></p>
14+
</div>
15+
<div class="row marketing">
16+
<div class="col-lg-6">
17+
<h4>Subheading</h4>
18+
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
19+
<h4>Subheading</h4>
20+
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
21+
<h4>Subheading</h4>
22+
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
23+
</div>
24+
<div class="col-lg-6">
25+
<h4>Subheading</h4>
26+
<p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>
27+
<h4>Subheading</h4>
28+
<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>
29+
<h4>Subheading</h4>
30+
<p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
31+
</div>
32+
</div>
33+
<div class="footer">
34+
<p>&copy; Company 2014</p>
3835
</div>
39-
</div>
40-
41-
<div class="footer">
42-
<p>&copy; Company 2014</p>
43-
</div>
44-
4536
</div>

cache-http/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

cache-partial/controllers/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function view_fn_cached() {
4242
var dt = new Date();
4343

4444
// Documentation: http://docs.totaljs.com/FrameworkCache/#framework.cache.fn
45-
fnSave(dt.format('dd.MM.yyyy - HH:mm:ss'), dt.add('m', 2));
45+
fnSave(dt.format('dd.MM.yyyy - HH:mm:ss'), '2 minutes');
4646

4747
}, fnCallback);
4848
}

cache-partial/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
var framework = require('total.js');
2-
var http = require('http');
3-
var debug = true;
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
46

5-
framework.run(http, debug);
7+
require('total.js').http('debug');

cache-static-file-refresh/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
var framework = require('total.js');
2-
var http = require('http');
1+
// ===================================================
2+
// IMPORTANT: only for development
3+
// total.js - web application framework for node.js
4+
// http://www.totaljs.com
5+
// ===================================================
36

47
// static cache works in release mode
5-
var debug = false;
68

7-
framework.run(http, debug);
9+
require('total.js').http('release');

changes/controllers/default.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
// Change describes some changes ...
22
var counter = 0;
33

4-
54
framework.route('/', function () {
65

76
var self = this;
87
counter++;
98

109
self.change('Counter was updated, current state: ' + counter);
11-
1210
self.plain('homepage');
1311

1412
});

0 commit comments

Comments
 (0)