4 |
5 | ## Related examples
6 |
7 | - https://github.com/totaljs/examples/tree/master/routing-resize
8 | - https://github.com/totaljs/examples/tree/master/download-file
--------------------------------------------------------------------------------
/threads/threads/products/schemas/products.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('Products', function(schema) {
2 |
3 | schema.action('query', {
4 | name: 'Query products list',
5 | action: function($) {
6 | // FUNC.TESTDB is defined in /definitions/db.js
7 | $.callback(FUNC.randomdata('products'));
8 | }
9 | });
10 |
11 | });
--------------------------------------------------------------------------------
/views/controllers/products.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /products/', view_products);
3 | };
4 |
5 | function view_products() {
6 | var self = this;
7 | self.title('Products');
8 |
9 | // this view is loaded by the controller name: /views/products/index.html
10 | self.view('index');
11 | }
--------------------------------------------------------------------------------
/streamer/index.js:
--------------------------------------------------------------------------------
1 | require('total4');
2 |
3 | RESTBuilder.GET('http://www.w3schools.com/xml/cd_catalog.xml').stream(function(err, response) {
4 | response.stream.on('data', U.streamer('', ' ', function(value, index) {
5 | var xml = value.parseXML(true);
6 | xml.index = index;
7 | console.log(xml);
8 | }));
9 | });
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 | .example-spacer {
2 | flex: 1 1 auto;
3 | }
4 |
5 | .main-body {
6 | padding-top: 20px;
7 | margin: 0 auto;
8 | max-width: 1348px;
9 | mat-form-field {
10 | width: 100%;
11 | }
12 | }
13 |
14 | .action {
15 | display: flex;
16 | gap: 5px;
17 | }
18 |
--------------------------------------------------------------------------------
/graphql/definitions/db.js:
--------------------------------------------------------------------------------
1 | // Insert demo data
2 |
3 | NOSQL('user').count().callback(function(err, data) {
4 | if (data.count === 0) {
5 | NOSQL('user').insert({id: 1, name: 'User 1', email: 'user 1 @gmail.com' });
6 | NOSQL('user').insert({id: 2, name: 'User 2', email: 'user 1 @gmail.com' });
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/sitemap/sitemap:
--------------------------------------------------------------------------------
1 | // identificator : NAME --> URL --> PARENT (optional)
2 |
3 | homepage : Homepage --> /
4 | contact : Contact --> /contact/ --> homepage
5 | terms : Terms --> /terms/ --> homepage
6 | privacy : Privacy --> /terms/privacy/ --> terms
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## IMPORTANT NOTE:
2 |
3 | All examples are optimized for Total.js `+4` version.
4 |
5 | ---
6 |
7 | ## How to run examples?
8 |
9 | - first you have to install __Total.js framework__ `$ npm install total4`
10 | - then run each example like this:
11 |
12 | ```bash
13 | $ cd workers
14 | $ node index.js
15 | ```
16 |
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/emp-add-edit/emp-add-edit.component.scss:
--------------------------------------------------------------------------------
1 | .content {
2 | padding-top: 10px;
3 | }
4 | .row {
5 | display: flex;
6 | gap: 10px;
7 |
8 | mat-form-field {
9 | width: 100%;
10 | }
11 | }
12 |
13 | .action {
14 | padding: 0px 25px 20px;
15 | button {
16 | flex: 1;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { RouterModule, Routes } from '@angular/router';
3 |
4 | const routes: Routes = [];
5 |
6 | @NgModule({
7 | imports: [RouterModule.forRoot(routes)],
8 | exports: [RouterModule]
9 | })
10 | export class AppRoutingModule { }
11 |
--------------------------------------------------------------------------------
/totaljs_react/server/index.js.map:
--------------------------------------------------------------------------------
1 | {
2 | "routes": [
3 | {
4 | "method": "POST",
5 | "url": "/",
6 | "owner": "controller_api",
7 | "schema": "OpenAI",
8 | "input": "*message:String"
9 | }
10 | ],
11 | "actions": [
12 | {
13 | "name": "OpenAI --> ask",
14 | "input": "*message:String"
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/upload-multipart/views/index.html:
--------------------------------------------------------------------------------
1 | @{meta('File upload')}
2 |
3 |
4 | Uploaded: @{model.info}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/views-xhr/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_homepage);
3 | ROUTE('POST /xhr/', xhr_panel, ['xhr']);
4 | };
5 |
6 | function view_homepage() {
7 | var self = this;
8 | self.view('company');
9 | }
10 |
11 | function xhr_panel() {
12 | var self = this;
13 | self.view(self.body.choice);
14 | }
--------------------------------------------------------------------------------
/assertion-testing/schemas/customers.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('Customers', function (schema) {
2 |
3 | schema.action('query', {
4 | name: 'Query',
5 | action: function ($) {
6 | $.callback([]);
7 | }
8 | });
9 |
10 | schema.action('read', {
11 | name: 'Read',
12 | action: function ($) {
13 | $.invalid('somet-error');
14 | }
15 | });
16 |
17 | });
--------------------------------------------------------------------------------
/components/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @{import('head', 'meta')}
7 |
8 |
9 |
10 |
11 | @{body}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/controller-mail/config:
--------------------------------------------------------------------------------
1 | // Mail settings
2 | mail_smtp : smtp.gmail.com
3 | mail_smtp_options : {"secure":true,"port":465,"user":"YOUR-GMAIL-EMAIL","password":"YOUR-GMAIL-PASSWORD","timeout":10000}
4 | mail_address_from : YOUR-GMAIL-EMAIL
5 | // mail_address_reply :
6 | // mail_address_bcc :
--------------------------------------------------------------------------------
/views-custom-helper/views/index.html:
--------------------------------------------------------------------------------
1 | @{helper test(max)}
2 | @{foreach m in new Array(max)}
3 | @{index}
4 | @{end}
5 | @{end}
6 |
7 |
8 |
9 | @{helpers.say('WARNING: XSS ')}
10 |
11 |
12 | @{helpers.say('WARNING: XSS ', true)}
13 |
14 | Inline helper
15 |
16 | @{test(10)}
--------------------------------------------------------------------------------
/pagination/views/partial-paging.html:
--------------------------------------------------------------------------------
1 | Paging @{model.page}/@{model.count}:
2 |
3 | @{foreach m in model.render()}
4 |
@{m.page}
5 | @{end}
6 |
@{model.items.format(0)} @{model.items.pluralize('items', 'item', 'items', 'items')}
7 |
--------------------------------------------------------------------------------
/totaljs_angular/client/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/graphql/views/index.html:
--------------------------------------------------------------------------------
1 | @{title('Something awesome')}
2 |
3 |
4 |
5 |
6 | The Node.js framework for all web developers with everything what you need.
7 | Create something awesome.
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/pagination/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('/', view_index);
3 | };
4 |
5 | function view_index() {
6 | var self = this;
7 | var products = 1000;
8 | var page = (self.query.page || '10').parseInt();
9 | var perpage = 20;
10 | var pagination = new Pagination(products, page, perpage, '?page={0}');
11 | self.view('index', pagination);
12 | }
--------------------------------------------------------------------------------
/totaljs_angular/client/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "include": [
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/request-to-response/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', pipe_homepage);
3 | ROUTE('GET /file/', pipe_file);
4 | };
5 |
6 | function pipe_homepage() {
7 | var self = this;
8 | self.proxy('https://www.totaljs.com');
9 | }
10 |
11 | function pipe_file() {
12 | var self = this;
13 | self.proxy('https://www.totaljs.com/img/logo.png');
14 | }
--------------------------------------------------------------------------------
/totaljs_react/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "openai": "^4.14.0",
14 | "total4": "^0.0.91"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/views-custom-helper/definitions/helpers.js:
--------------------------------------------------------------------------------
1 | DEF.helpers.now = function() {
2 | // this === controller
3 | // current view model: this.model
4 |
5 | return new Date().format('dd.MM.yyyy HH:mm:ss');
6 | };
7 |
8 | DEF.helpers.say = function(what, raw) {
9 | // this === controller
10 | // current view model: this.model
11 | return raw ? what : what.toString().encode();
12 | };
--------------------------------------------------------------------------------
/blocks/public/js/script.js:
--------------------------------------------------------------------------------
1 | function common_code() {
2 |
3 | }
4 |
5 | // =======================================
6 | // @{BLOCK admin}
7 | // =======================================
8 | setTimeout(function() {
9 | alert('ADMIN BLOCK --> code only for admin area');
10 | }, 1000);
11 | // =======================================
12 | // @{end}
13 | // =======================================
--------------------------------------------------------------------------------
/static-file-handling/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /');
3 | ROUTE('FILE /*.*', image_resize, ['.jpg', '.png', '.gif']);
4 | };
5 |
6 | function image_resize(req, res) {
7 | res.image(PATH.public(req.url), function(image) {
8 | // image === FrameworkImage
9 | image.resize('80%');
10 | image.quality(80);
11 | image.minify();
12 | });
13 | }
--------------------------------------------------------------------------------
/totaljs_vuejs/server/databases/tutorials.nosql:
--------------------------------------------------------------------------------
1 | {"title":"total.js Lesscode","description":"Description of the lesscode application","id":"19fz5001ym51d","search":"totaljs lescode","dtcreated":"2024-02-12T08:05:23.595Z"}
2 | {"title":"Totaljs Code editor","description":"Description of totaljs code editor","id":"19fz5002ym50d","search":"totaljs code editor","dtcreated":"2024-02-12T08:05:23.595Z"}
3 |
--------------------------------------------------------------------------------
/workers/definitions/worker.js:
--------------------------------------------------------------------------------
1 | function refresh() {
2 |
3 | // workers/weather.js will runs in other process
4 | var worker = WORKER('xml', 5000);
5 |
6 | // worker === http://nodejs.org/api/child_process.html#child_process_class_childprocess
7 | worker.on('message', function(obj) {
8 | MAIN.xml = obj;
9 | });
10 | }
11 |
12 | ONCE('load', refresh);
13 | setInterval(refresh, 5000);
--------------------------------------------------------------------------------
/blocks/definitions/blocks.js:
--------------------------------------------------------------------------------
1 | // JavaScript
2 | MAP('/js/admin.js', '/js/script.js#admin'); // --> #admin is defined block
3 |
4 | // CSS
5 | MAP('/css/admin.css', '/css/style.css#admin'); // --> #admin is defined block
6 |
7 | // Others examples with merging:
8 | // MERGE('/css/website.css', 'ui.css#blockB,blockC', 'website.css');
9 | // MERGE('/css/admin.css', 'ui.css#blockA,blockB,blockC', 'admin.css');
--------------------------------------------------------------------------------
/download-file/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', file_download);
3 | ROUTE('GET /image/', image_download);
4 | };
5 |
6 | function file_download() {
7 | this.file('totaljs.pdf', 'logo.pdf');
8 | }
9 |
10 | function image_download() {
11 | this.image('slovakia.jpg', function(image) {
12 | image.resize('50%');
13 | image.minify();
14 | });
15 | }
--------------------------------------------------------------------------------
/image-resize/views/index.html:
--------------------------------------------------------------------------------
1 | @{meta('Upload example')}
2 |
3 | @{if model.url}
4 | @{!model.url}
5 | @{fi}
6 |
7 |
8 | Uploaded: @{model.info}
9 |
10 |
11 |
--------------------------------------------------------------------------------
/image-watermark/views/index.html:
--------------------------------------------------------------------------------
1 | @{meta('Upload example')}
2 |
3 | @{if model.url}
4 | @{!model.url}
5 | @{fi}
6 |
7 |
8 | Uploaded: @{model.info}
9 |
10 |
11 |
--------------------------------------------------------------------------------
/flowstream/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flowstream",
3 | "description": "Total.js FlowStream",
4 | "version": "1.0.0",
5 | "main": "index.js",
6 | "dependencies": {
7 | "total4": "latest"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "keywords": ["flowstream", "dashboard"],
13 | "author": "Peter Širka",
14 | "license": "MIT"
15 | }
--------------------------------------------------------------------------------
/localization/resources/cz.resource:
--------------------------------------------------------------------------------
1 | // How to generate translate file from views?
2 | // $ total --translate
3 | // $ total --translate "Create translation hash from this text."
4 |
5 | // index.html
6 | T1bx8wg2 : Vítejte
7 |
8 | // layout.html
9 | T1sghbn7 : Zpráva:
10 | T121zmsb : Zvolená lokalizace byla uložena do cookie.
11 |
12 | message : Toto je zpráva z cz.resource
--------------------------------------------------------------------------------
/localization/resources/sk.resource:
--------------------------------------------------------------------------------
1 | // How to generate translate file from views?
2 | // $ total --translate
3 | // $ total --translate "Create translation hash from this text."
4 |
5 | // index.html
6 | T1bx8wg2 : Vitajte
7 |
8 | // layout.html
9 | T1sghbn7 : Správa:
10 | T121zmsb : Vybraná lokalizácia bola uložená do cookie.
11 |
12 | message : Toto je správa z sk.resource
--------------------------------------------------------------------------------
/remote-terminal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "remote-terminal",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "server.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "Peter Širka",
11 | "license": "MIT",
12 | "dependencies": {
13 | "node-pty": "latest",
14 | "total4": "latest"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tms/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tmsexample",
3 | "description": "TMS Example",
4 | "version": "1.0.0",
5 | "main": "index.js",
6 | "dependencies": {
7 | "total4": "latest"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "keywords": [
13 | "example",
14 | "tms",
15 | "totaljs"
16 | ],
17 | "author": "Jakub Urban",
18 | "license": "MIT"
19 | }
20 |
--------------------------------------------------------------------------------
/middleware/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view, ['#A'], { options: 'for middleware' });
3 | ROUTE('GET /b/', view, ['#B']);
4 | ROUTE('GET /c/', view, ['#C']); // if the flag starts with # then is registered as middleware
5 | ROUTE('GET /all/', view, ['#A', '#B', '#C']);
6 | };
7 |
8 | function view() {
9 | var self = this;
10 | self.json(self.repository);
11 | }
--------------------------------------------------------------------------------
/contact-form/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /');
3 |
4 | ROUTE('POST /api/send/ *ContactForms --> save');
5 | ROUTE('POST /api/upload/', upload, 1024 * 5); // max. 5 MB
6 | };
7 |
8 | function upload() {
9 | var self = this;
10 | var file = self.files[0];
11 | if (file)
12 | file.fs('files', UID(), (err, meta) => self.json(meta));
13 | else
14 | self.invalid(400);
15 | }
--------------------------------------------------------------------------------
/threads/definitions/db.js:
--------------------------------------------------------------------------------
1 | // We want to initialize this definition file only for threads (not for main process)
2 | if (THREAD) {
3 | // This script will be executed for each thread
4 | console.log('DATABASE READY FOR:', THREAD);
5 |
6 | FUNC.randomdata = function(type) {
7 | var arr = [];
8 | for (var i = 0; i < 10; i++)
9 | arr.push({ id: GUID(5), name: type + ' ' + (i + 1) });
10 | return arr;
11 | };
12 | }
--------------------------------------------------------------------------------
/localization/resources/en.resource:
--------------------------------------------------------------------------------
1 | // How to generate translate file from views?
2 | // $ total --translate
3 | // $ total --translate "Create translation hash from this text."
4 |
5 | // index.html
6 | T1bx8wg2 : Welcome
7 |
8 | // layout.html
9 | T1sghbn7 : Message:
10 | T121zmsb : The selected localization has been stored into the cookie.
11 |
12 | message : This is the message from en.resource
--------------------------------------------------------------------------------
/configuration/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_index);
3 | };
4 |
5 | function view_index() {
6 |
7 | var builder = [];
8 | var self = this;
9 |
10 | Object.keys(CONF).forEach(function(o) {
11 | var value = CONF[o];
12 | builder.push('{0} : {1}'.format(o.padRight(30, ' '), value instanceof Array ? value.join(', ') : value));
13 | });
14 |
15 | self.plain(builder.join('\n'));
16 | }
--------------------------------------------------------------------------------
/totaljs_react/client/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/totaljs_react/server/index.js.overload:
--------------------------------------------------------------------------------
1 | {"id":null,"version":{"node":"v18.18.0","total":"4","build":4091,"app":"1.0.0"},"pid":14652,"thread":"","mode":"debug","overload":1,"date":"2023-10-26T14:47:37.026Z","memory":12.82,"rm":0,"fm":0,"wm":0,"em":0,"mm":0,"om":0,"dm":0,"um":0,"pm":0,"sm":0,"cm":0,"dbrm":0,"dbwm":0,"usage":100,"requests":0,"pending":0,"external":0,"errors":0,"timeouts":0,"online":0,"uptime":651,"download":0,"upload":0,"status":[]}
2 |
--------------------------------------------------------------------------------
/blocks/public/css/style.css:
--------------------------------------------------------------------------------
1 | body { background-color: white; font-size: 12px; font-family: Arial; }
2 |
3 | /*
4 | * @{BLOCK admin}
5 | */
6 | div { background-color: red; color: white; padding: 10px 0; }
7 | b { font-size: 14px; }
8 | body:before { content: 'ADMIN AREA'; }
9 | /*
10 | * @{end}
11 | */
12 |
13 | /*
14 | * @{BLOCK blockA, blockB, blockC}
15 | */
16 | div { content: 'ANOTHER EXAMPLE'; }
17 | /*
18 | * @{end}
19 | */
20 |
--------------------------------------------------------------------------------
/themes/public/css/common.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0; font-family: Arial; font-size: 14px; line-height: 20px; color: white; }
2 | h1 { text-align: center; font-size: 30px; margin: 50px 0; padding: 0; }
3 | div { font-size: 11px; }
4 | a { display: inline-block; position: relative; border: 3px solid white; border-radius: 4px; text-decoration: none; color: white; font-size: 20px; text-align: center; padding: 10px 20px; }
5 | p { text-align: center; }
--------------------------------------------------------------------------------
/totaljs_react/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/totaljs_react/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
--------------------------------------------------------------------------------
/localization/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_index);
3 | ROUTE('GET /', json_index, ['xhr']);
4 | };
5 |
6 | function view_index() {
7 | var self = this;
8 | self.view('index');
9 | }
10 |
11 | function json_index() {
12 | var self = this;
13 | // console.log(TRANSLATE(self.language, 'Welcome')); --> converts "Welcome" to hash code
14 | self.json({ message: RESOURCE(self.language, 'message') });
15 | }
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/core/core.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { CoreService } from './core.service';
4 |
5 | describe('CoreService', () => {
6 | let service: CoreService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(CoreService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/localization-external/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_index);
3 | ROUTE('GET /', json_index, ['xhr']);
4 | };
5 |
6 | function view_index() {
7 | var self = this;
8 | self.view('index');
9 | }
10 |
11 | function json_index() {
12 | var self = this;
13 | // console.log(TRANSLATE(self.language, 'Welcome')); --> converts "Welcome" to hash code
14 | self.json({ message: RESOURCE(self.language, 'message') });
15 | }
--------------------------------------------------------------------------------
/themes/themes/red/index.js:
--------------------------------------------------------------------------------
1 | // This is the initialization script for this theme
2 | // Is optional
3 | exports.install = function() {
4 |
5 | // Custom mapping
6 | MAP('/red-theme-style.css', '=red/public/css/default.css');
7 | // Try: http://127.0.0.1:8000/red-theme-style.css
8 |
9 | console.log('RED THEME IS INITIALIZED');
10 |
11 | // =red --> is a shortcut and the framework compiles it as `/app/themes/red/` path.
12 | // F.merge() is same as F.map()
13 | };
--------------------------------------------------------------------------------
/views/controllers/users.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /users/', view_users);
3 | ROUTE('GET /users/admin/', view_users_admin);
4 | };
5 |
6 | function view_users() {
7 | var self = this;
8 | self.title('Users');
9 |
10 | // this view is loaded by the controller name: /views/users/index.html
11 | self.view('index');
12 | }
13 |
14 | function view_users_admin() {
15 | var self = this;
16 | self.title('Admin');
17 | self.view('~admin');
18 | }
--------------------------------------------------------------------------------
/flowstream/databases/flow/dashboard.html:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Dashboard
19 |
--------------------------------------------------------------------------------
/controller-mail/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_homepage);
3 | ROUTE('GET /mail/', redirect_mail);
4 | };
5 |
6 | function view_homepage() {
7 | this.view('homepage');
8 | }
9 |
10 | function redirect_mail() {
11 |
12 | var self = this;
13 |
14 | // This function automatically reads view: email.html
15 | MAIL('petersirka@gmail.com', 'Test e-mail', '~email', { name: 'MODEL NAME' });
16 |
17 | self.redirect('/?success=1');
18 | }
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/services/employee.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { EmployeeService } from './employee.service';
4 |
5 | describe('EmployeeService', () => {
6 | let service: EmployeeService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(EmployeeService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/graphql/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "totalgraphql",
3 | "description": "Total.js with Graphql",
4 | "version": "1.0.0",
5 | "main": "index.js",
6 | "dependencies": {
7 | "@graphql-tools/schema": "^7.1.5",
8 | "express-graphql": "^0.12.0",
9 | "total4": "^0.0.81"
10 | },
11 | "scripts": {
12 | "test": "echo \"Error: no test specified\" && exit 1"
13 | },
14 | "keywords": [
15 | "empty",
16 | "project"
17 | ],
18 | "author": "Thao Huynh",
19 | "license": "MIT"
20 | }
21 |
--------------------------------------------------------------------------------
/querybuildermysql/definitions/db.js:
--------------------------------------------------------------------------------
1 | // /definitions/db.js
2 | // npm install querybuildermysql2
3 | require('querybuildermysql2').init('default', CONF.database);
4 | // require('querybuildermysql2').init(name, connectionstring, pooling, [errorhandling]);
5 | // name {String} a name of DB (default: "default")
6 | // connectionstring {String} a connection to the [__ MySQL__](https://www.mysql.com)
7 | // pooling {Number} max. clients (default: "0" (disabled))
8 | // errorhandling {Function(err, cmd)}
9 |
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/core/core.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { MatSnackBar } from '@angular/material/snack-bar';
3 |
4 | @Injectable({
5 | providedIn: 'root',
6 | })
7 | export class CoreService {
8 | constructor(private _snackBar: MatSnackBar) {}
9 |
10 | openSnackBar(message: string, action: string = 'ok') {
11 | this._snackBar.open(message, action, {
12 | duration: 1000,
13 | verticalPosition: 'top',
14 | });
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/flowstream/README.md:
--------------------------------------------------------------------------------
1 | # Total.js FlowStream Example
2 |
3 | - [Website](https://www.totaljs.com/)
4 | - [__Documentation__](https://docs.totaljs.com/total4/5aed1001bj51c/)
5 | - [Chat support](https://platform.totaljs.com/?open=messenger)
6 | - [Join __Total.js Telegram__](https://t.me/totalplatform)
7 | - [Support](https://www.totaljs.com/support/)
8 |
9 | This example contains a full example with Total.js FlowStream and Dashboard.
10 |
11 | __Requirements__:
12 |
13 | - Total.js 4 - `$ npm install total4`
--------------------------------------------------------------------------------
/views-websocket/public/css/default.css:
--------------------------------------------------------------------------------
1 | /*auto*/
2 |
3 | body { font-family: Arial; font-size: 14px; line-height: 16px; color: gray; background-color: white; margin: 0; }
4 | nav { background-color: #F0F0F0; padding: 20px; }
5 | nav a { position: relative; display: inline-block; margin-right: 15px; text-decoration: none; color: gray; padding: 5px; }
6 | nav .selected { color: black; background-color: white; }
7 | #body { padding: 30px; }
8 | h1 { font: normal bold 18px Arial; margin: 0 0 20px; padding: 0; color: black; }
--------------------------------------------------------------------------------
/versions/versions:
--------------------------------------------------------------------------------
1 | // Static files mapping according a version
2 |
3 | // WHY?
4 | // You can change a name of static file without replacement name in all names in all project files.
5 |
6 | // The files below must exists
7 | /js/script.js : /js/script023.js
8 | /css/style.css : /css/style001.css
9 |
10 | // The framework creates mapping
11 | /img/logo.png --> /img/logo004.png
12 |
13 | // The framework updates paths in CSS "background" or "background-image" too
14 | /img/bg.png : /img/bg002.png
--------------------------------------------------------------------------------
/postgresql/views/index.html:
--------------------------------------------------------------------------------
1 | Below is a list of all users
2 |
3 |
4 |
5 |
6 |
7 |
8 | @{foreach var m in model}
9 |
10 | @{m.id}
11 | @{m.age}
12 | @{m.name}
13 |
14 | @{end}
15 |
--------------------------------------------------------------------------------
/serverless/README.md:
--------------------------------------------------------------------------------
1 | # Total.js with Serverless example
2 |
3 | __Instructions__:
4 | - install serverless `$ npm install -g serverless`
5 | - install the modules from NPM `$ npm install`
6 | - local test run `$ serverless offline`
7 | - open browser `http://localhost:3000/dev`
8 | - open browser for api `http://localhost:3000/dev/api/users`
9 |
10 | __Deploy on AWS Lambda__:
11 | - Follow setup AWS: https://www.serverless.com/framework/docs/providers/aws/guide/credentials/
12 | - Deploy on AWS run `$ serverless deploy`
13 |
14 |
--------------------------------------------------------------------------------
/totaljs_react/server/schemas/openai.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('OpenAI', function(schema) {
2 | schema.action('ask', {
3 | name: 'Ask to chatgpt',
4 | input: '*message:String',
5 | action: async function($, model) {
6 | var message = model.message;
7 | const completion = await MAIN.openai.completions.create({
8 | model: 'gpt-3.5-turbo-instruct',
9 | prompt: `${message}`,
10 | max_tokens: 100,
11 | temperature: 0.5
12 | });
13 |
14 | $.callback({ message: completion.choices[0].text });
15 | }
16 | })
17 |
18 | })
--------------------------------------------------------------------------------
/custom-headers/views/homepage.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 | Custom headers
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | @{header('X-Frame-Options', 'SAMEORIGIN')}
16 |
17 | CUSTOM HEADERS
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/assertion-testing/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 |
3 | ROUTE('GET /customers/ *Customers --> query');
4 | ROUTE('GET /customers/{id}/ *Customers --> read');
5 |
6 | // Testing route
7 | ROUTE('GET /test/', test);
8 |
9 | };
10 |
11 | // Action which performs unit-testing
12 | function test() {
13 |
14 | // this === Total.js Controller
15 | var self = this;
16 |
17 | self.runtest('GET /customers/', 'Customers-->@query');
18 | self.runtest('GET /customers/123/', 'Customers-->@read'); // Invalid Id
19 | }
20 |
--------------------------------------------------------------------------------
/form/schemas/users.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('Users', function(schema) {
2 |
3 | schema.define('name', 'Name', true);
4 | schema.define('email', 'Email', true);
5 |
6 | schema.action('insert', {
7 | name: 'Insert new user',
8 | action: function($, model) {
9 | model.id = UID();
10 | model.dtcreated = NOW;
11 | NOSQL('users').insert(model).callback($.done(model.id));
12 | }
13 | });
14 |
15 | schema.action('list', {
16 | name: 'List users',
17 | action: function($) {
18 | NOSQL('users').find().callback($.callback);
19 | }
20 | });
21 | });
--------------------------------------------------------------------------------
/serverless/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function () {
2 |
3 | ROUTE('GET /', function () {
4 | var self = this;
5 | self.plain('REST Service {0}\nVersion: {1}'.format(CONF.name, CONF.version));
6 | });
7 |
8 | // Sets cors for the entire API
9 | CORS();
10 | ROUTE('GET /api/users/ *Users --> query');
11 | ROUTE('GET /api/users/{id}/ *Users --> read');
12 | ROUTE('POST /api/users/ *Users --> insert');
13 | ROUTE('PUT /api/users/{id}/ *Users --> update');
14 | ROUTE('DELETE /api/users/{id}/ *Users --> remove');
15 | };
--------------------------------------------------------------------------------
/upload-multipart/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_homepage);
3 |
4 | // the number is maximum data receive
5 | ROUTE('POST /', view_homepage, ['upload'], 100); // max. 100 kB
6 | };
7 |
8 | function view_homepage() {
9 | var self = this;
10 |
11 | var model = { info: '...' };
12 |
13 | if (self.files.length > 0)
14 | model.info = self.files[0].filename + ' ({0} kB - {1}x{2})'.format(Math.floor(self.files[0].length / 1024, 2), self.files[0].width, self.files[0].height);
15 |
16 | self.view('index', model);
17 | }
--------------------------------------------------------------------------------
/totaljs_vuejs/server/controllers/api.js:
--------------------------------------------------------------------------------
1 | exports.install = function () {
2 | CORS();
3 | ROUTE('GET /api/tutorials/ *Tutorials --> query');
4 | ROUTE('POST /api/tutorials/ *Tutorials --> insert');
5 | ROUTE('GET /api/tutorials/{id}/ *Tutorials --> read');
6 | ROUTE('PUT /api/tutorials/{id}/ *Tutorials --> update');
7 | ROUTE('DELETE /api/tutorials/{id}/ *Tutorials --> delete');
8 | ROUTE('DELETE /api/tutorials/ *Tutorials --> delete_all');
9 | };
10 |
11 |
--------------------------------------------------------------------------------
/workers/workers/xml.js:
--------------------------------------------------------------------------------
1 | require('total4');
2 |
3 | // Loads the framework without HTTP server
4 | LOAD('config', function() {
5 |
6 | RESTBuilder.GET(CONF.url).stream(function(err, response) {
7 |
8 | if (err) {
9 | console.error(err);
10 | return process.exit();
11 | }
12 |
13 | var data = [];
14 |
15 | response.stream.on('data', U.streamer('', ' ', function(item) {
16 | data.push(item.parseXML());
17 | }));
18 |
19 | response.stream.on('end', function() {
20 | process.send(data);
21 | process.exit();
22 | });
23 |
24 | });
25 | });
--------------------------------------------------------------------------------
/totaljs_react/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/totaljs_angular/client/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3 | "version": "0.2.0",
4 | "configurations": [
5 | {
6 | "name": "ng serve",
7 | "type": "pwa-chrome",
8 | "request": "launch",
9 | "preLaunchTask": "npm: start",
10 | "url": "http://localhost:4200/"
11 | },
12 | {
13 | "name": "ng test",
14 | "type": "chrome",
15 | "request": "launch",
16 | "preLaunchTask": "npm: test",
17 | "url": "http://localhost:9876/debug.html"
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/views-websocket/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /*', 'app');
3 | ROUTE('SOCKET /', reader);
4 | };
5 |
6 | function reader() {
7 | var self = this;
8 | self.on('message', function(client, message) {
9 | switch (message.url) {
10 | case '/':
11 | case '/company/':
12 | case '/products/':
13 | case '/contact/':
14 | var view = message.url.replace(/\//g, '');
15 | client.send({ status: 200, body: VIEW(view || 'homepage') });
16 | break;
17 | default:
18 | client.send({ status: 404 });
19 | break;
20 | }
21 | });
22 | }
--------------------------------------------------------------------------------
/download-file-counter/controllers/default.js:
--------------------------------------------------------------------------------
1 | var counter = 0;
2 |
3 | exports.install = function() {
4 |
5 | // route index
6 | ROUTE('GET /', view_homepage);
7 |
8 | // file route
9 | ROUTE('FILE /*.pdf', file_download);
10 | };
11 |
12 | function view_homepage() {
13 | var self = this;
14 | self.plain(self.req.hostname('/totaljs.pdf') + '\n\nDownload count: ' + counter);
15 | }
16 |
17 | function file_download(req, res) {
18 |
19 | // this === framework
20 | var filename = U.getName(req.url);
21 |
22 | counter++;
23 |
24 | // response file
25 | res.file(PATH.public(filename), filename);
26 | }
--------------------------------------------------------------------------------
/authorization-www-basic/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', auth);
3 | };
4 |
5 | function auth() {
6 |
7 | var self = this;
8 | var auth = self.baa();
9 |
10 | // "baa" means "B"asic "A"ccess "A"uthentication
11 |
12 | if (auth.empty) {
13 | self.baa('This is secured area');
14 | // It sends the response automatically.
15 | return;
16 | }
17 |
18 | if (auth.user !== 'totaljs' || auth.password !== '123456') {
19 | self.baa('Wrong credentials, this is secured area:');
20 | // or self.view401();
21 | return;
22 | }
23 |
24 | self.plain('You are authorized.');
25 | }
--------------------------------------------------------------------------------
/totaljs_vuejs/client/src/router.js:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import Router from "vue-router";
3 |
4 | Vue.use(Router);
5 |
6 | export default new Router({
7 | mode: "history",
8 | routes: [
9 | {
10 | path: "/",
11 | alias: "/tutorials",
12 | name: "tutorials",
13 | component: () => import("./components/TutorialsList")
14 | },
15 | {
16 | path: "/tutorials/:id",
17 | name: "tutorial-details",
18 | component: () => import("./components/Tutorial")
19 | },
20 | {
21 | path: "/add",
22 | name: "add",
23 | component: () => import("./components/AddTutorial")
24 | }
25 | ]
26 | });
27 |
--------------------------------------------------------------------------------
/components/components/contactform.html:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | @{if settings.email}@{model.email} @{fi}Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum saepe magnam odio minus id temporibus illum doloremque aliquid, consequatur nulla!
7 |
8 |
9 |
--------------------------------------------------------------------------------
/totaljs_angular/server/controllers/api.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | // Enable CORS
3 | // CORS('/api/*', ['http://localhost:4200']);
4 |
5 |
6 | // API endpoints
7 | ROUTE('GET /api/employees/ *Employees --> list');
8 | ROUTE('POST /api/employees/create/ *Employees --> create');
9 | ROUTE('GET /api/employees/read/{id}/ *Employees --> read');
10 | ROUTE('PUT /api/employees/update/{id}/ *Employees --> update');
11 | ROUTE('DELETE /api/employees/remove/{id}/ *Employees --> remove');
12 | }
--------------------------------------------------------------------------------
/validation/schemas/contacts.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('Contacts', function(schema) {
2 |
3 | schema.define('firstname', 'Name(30)', true);
4 | schema.define('lastname', 'Name(30)', true);
5 | schema.define('email', 'Email', true);
6 | schema.define('age', Number, age => age < 18 ? 'You are too young.' : age > 40 ? 'You are too old' : true);
7 | schema.define('terms', Boolean, true);
8 |
9 | schema.action('save', {
10 | name: 'Save contact',
11 | action: function($, model) {
12 | model.id = UID();
13 | model.dtcreated = NOW;
14 | delete model.terms;
15 | NOSQL('contacts').insert(model).callback($.done());
16 | }
17 | });
18 | });
--------------------------------------------------------------------------------
/components/views/index.html:
--------------------------------------------------------------------------------
1 | Components
2 |
3 | DateTime 1
4 | @{component('datetime')}
5 |
6 | Contact form 1
7 | @{component('contactform')}
8 |
9 | Newsletter 1
10 | @{component('newsletter')}
11 |
12 | Contact form 2
13 | @{component('contactform', { email: true })}
14 |
15 | Contact form 3
16 | @{component('contactform')}
17 |
18 | Newsletter 2
19 | @{component('newsletter')}
20 |
21 | Contact form 4
22 | @{component('contactform')}
23 |
24 | Newsletter 3
25 | @{component('newsletter')}
26 |
27 | DateTime 2
28 | @{component('datetime')}
29 |
--------------------------------------------------------------------------------
/totaljs_react/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals(console.log);
18 |
--------------------------------------------------------------------------------
/video-streaming/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/querybuilderpg/definitions/db.js:
--------------------------------------------------------------------------------
1 | // Requiring the 'querybuilderpg' module.
2 | var queryBuilder = require('querybuilderpg');
3 |
4 | // Initializing the 'querybuilderpg' module with the following parameters:
5 | // 1. 'default': This specifies the name of the connection pool. It could be any string identifier.
6 | // 2. CONF.database: It contains the configuration details for connecting to the PostgreSQL database.
7 | // 3. 1: This specifies the number of database connections in the pool.
8 | // 4. ERROR('Postgres'): This specifies an error handler function for handling PostgreSQL-related errors.
9 | queryBuilder.init('default', CONF.database, 1, ERROR('Postgres'));
--------------------------------------------------------------------------------
/restbuilder/server/definitions/db.js:
--------------------------------------------------------------------------------
1 | // Requiring the 'querybuilderpg' module.
2 | var queryBuilder = require('querybuilderpg');
3 |
4 | // Initializing the 'querybuilderpg' module with the following parameters:
5 | // 1. 'default': This specifies the name of the connection pool. It could be any string identifier.
6 | // 2. CONF.database: It contains the configuration details for connecting to the PostgreSQL database.
7 | // 3. 1: This specifies the number of database connections in the pool.
8 | // 4. ERROR('Postgres'): This specifies an error handler function for handling PostgreSQL-related errors.
9 | queryBuilder.init('default', CONF.database, 1, ERROR('Postgres'));
--------------------------------------------------------------------------------
/image-middleware-pngquant/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | The image is resized about 50% and shrinked with PNGQUANT. Try to remove the middleware with PNGQUANT and watch the file size.
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/views-place-sections/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | @{head}
11 |
12 |
13 |
14 |
15 |
16 | @{section('header')}
17 |
18 | @{place('header')}
19 |
20 | @{body}
21 |
22 |
23 | @{place('scripts')}
24 |
25 |
26 | @{section('footer')}
27 |
28 |
29 |
--------------------------------------------------------------------------------
/restbuilder/client/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /test/standard/', test_standard);
3 | ROUTE('GET /test/api/', test_api);
4 | }
5 |
6 |
7 | function test_standard() {
8 | // Example usage of the test functions
9 | var id = '162an001ih52d'; // Replace with an actual product ID
10 | var data = { name: 'Sample Product', price: 100, description: 'This is a sample product description'};
11 |
12 | FUNC.testListEndpoint();
13 | FUNC.testCreateEndpoint(data);
14 | FUNC.testReadEndpoint(id);
15 | FUNC.testUpdateEndpoint(id, data);
16 | FUNC.testToggleEndpoint(id);
17 | FUNC.testDeleteEndpoint(id);
18 | }
--------------------------------------------------------------------------------
/totaljs_angular/client/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CrudApp
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/querybuildermysql/database.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `tbl_user` (
2 | `id` VARCHAR(255) NOT NULL,
3 | `gender` ENUM('male', 'female') NOT NULL,
4 | `firstname` VARCHAR(40) NOT NULL,
5 | `lastname` VARCHAR(40) NOT NULL,
6 | `role` ENUM('collector', 'buyer') NOT NULL,
7 | `phone` VARCHAR(20) NOT NULL,
8 | `password` VARCHAR(255) NOT NULL,
9 | `pincode` INT NOT NULL,
10 | `photo` TEXT,
11 | `isremoved` BOOLEAN DEFAULT FALSE,
12 | `dtcreated` DATETIME DEFAULT CURRENT_TIMESTAMP,
13 | `dtupdated` DATETIME ON UPDATE CURRENT_TIMESTAMP,
14 | `countlogin` INT DEFAULT 0,
15 | `isonline` BOOLEAN DEFAULT FALSE,
16 | PRIMARY KEY (`id`)
17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--------------------------------------------------------------------------------
/versions/index.js.json:
--------------------------------------------------------------------------------
1 | {
2 | "pid": 1649,
3 | "port": 8000,
4 | "ip": "0.0.0.0",
5 | "stats": [
6 | {
7 | "id": null,
8 | "version": {
9 | "node": "v15.3.0",
10 | "total": "4.0.0",
11 | "app": "1.0.0"
12 | },
13 | "pid": 1649,
14 | "thread": "",
15 | "mode": "debug",
16 | "overload": 0,
17 | "date": "2020-12-06T22:01:44.581Z",
18 | "memory": 8.86,
19 | "rm": 0,
20 | "fm": 0,
21 | "wm": 0,
22 | "em": 0,
23 | "mm": 0,
24 | "om": 0,
25 | "dbrm": 0,
26 | "dbwm": 0,
27 | "usage": 0,
28 | "requests": 9,
29 | "pending": 0,
30 | "errors": 0,
31 | "timeouts": 0,
32 | "online": 0,
33 | "uptime": 1
34 | }
35 | ]
36 | }
--------------------------------------------------------------------------------
/authorization/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 |
3 | // Main routes
4 | ROUTE('GET /', view_logged, ['authorize']);
5 | ROUTE('GET /', view_unlogged);
6 |
7 | // Operations are defined in /schemas/users.js
8 | ROUTE('POST /login/ *Users --> login', ['unauthorize']);
9 | ROUTE('GET /logout/ *Users --> logout', ['authorize']);
10 |
11 | };
12 |
13 | function view_logged() {
14 | var self = this;
15 | self.plain('You are logged as {0}. To unlogged remove cookie __user or click http://{1}:{2}/logout/'.format(self.user.email, F.ip, F.port));
16 | }
17 |
18 | function view_unlogged() {
19 | var self = this;
20 | self.view('homepage', { email: '@' });
21 | }
--------------------------------------------------------------------------------
/static-file-merge/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 | Merging
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | OPEN WEB DEVELOPER TOOLS -> CONSOLE
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/contact-form/schemas/forms.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('ContactForms', function(schema) {
2 |
3 | schema.define('fileid', 'UID');
4 | schema.define('email', 'Email', true);
5 | schema.define('phone', 'Phone');
6 | schema.define('message', 'String(10000)', true);
7 |
8 |
9 | schema.action('save', {
10 | name: 'Save',
11 | action: function ($, model) {
12 |
13 | // Extends model
14 | model.dtcreated = NOW;
15 | model.ip = $.ip;
16 | model.ua = ($.headers['user-agent'] || '').parseUA();
17 |
18 | DATA.insert('nosql/contactforms', model);
19 |
20 | // var mail = MAIL(....);
21 | // model.fileid && mail.attachmentfs('files', model.fileid);
22 |
23 | $.success();
24 | }
25 | });
26 | });
--------------------------------------------------------------------------------
/flowstream/databases/dashboard/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | {{ title }}
10 |
11 |
12 |
--------------------------------------------------------------------------------
/middleware/definitions/middleware.js:
--------------------------------------------------------------------------------
1 | MIDDLEWARE('A', function($) {
2 |
3 | if ($.controller)
4 | $.controller.repository.A = 'middleware - private - A';
5 |
6 | $.next();
7 |
8 | });
9 |
10 | MIDDLEWARE('B', function($) {
11 |
12 | console.log('B');
13 |
14 | if ($.controller)
15 | $.controller.repository.B = 'middleware - private - B';
16 |
17 | $.next();
18 |
19 | });
20 |
21 | MIDDLEWARE('C', function($) {
22 |
23 | console.log('C');
24 |
25 | if ($.controller)
26 | $.controller.repository.C = 'middleware - private - C';
27 |
28 | $.next();
29 |
30 | });
31 |
32 | MIDDLEWARE('X', function($) {
33 | console.log('Global middleware: X');
34 | $.next();
35 | });
36 |
37 | USE('X');
--------------------------------------------------------------------------------
/cluster/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total.js Cluster
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 | @{body}
19 |
20 |
21 |
--------------------------------------------------------------------------------
/flowstream/public/windows/flow.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/routing-resize/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 | Original
4 |
5 |
6 |
7 | Small (100x100)
8 |
9 |
10 |
11 | Medium (only .png)
12 |
13 |
14 |
15 |
16 |
17 |
18 | Original grayscale
19 |
20 |
21 |
22 | Some filters
23 |
24 |
25 |
26 | 50 percent
27 |
--------------------------------------------------------------------------------
/image-resize/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 | @{body}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/image-watermark/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 | @{body}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/views-place-sections/views/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{section header}
5 | SECTION: header
6 | @{end}
7 |
8 | @{place('scripts', '')}
9 |
10 |
11 | @{place('scripts', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', '//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js')}
12 |
13 |
14 | Welcome!
15 |
16 |
17 | @{place('header', 'PLACE HOLDER ')}
18 |
19 | @{section footer}
20 | SECTION: footer
21 | @{end}
--------------------------------------------------------------------------------
/flow/README.md:
--------------------------------------------------------------------------------
1 | # Total.js inline Flow
2 |
3 | Total.js framework supports inline Flow files which can be edited at https://floweditor.totaljs.com (offline) - just drag and drop the file to the Flow editor. Total.js Code editor includes an offline flow editor for `flowstreams/*.flow` files.
4 |
5 | The framework watches all `flowstreams/*.flow` files and automatically restarts the app after a change is made. You can use this mechanism for creating workflows, services or extending app functionality.
6 |
7 | __IMPORTANT:__ all flow files are evaluated in the app process directly (there is no worker involved), so created routes can work without a reverse proxy and every Flow can change existing Total.js app functionality.
8 |
9 | ---
--------------------------------------------------------------------------------
/themes/themes/red/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | @{import('meta', 'head', '~common.css', 'default.css')}
13 |
14 |
15 | THEME: @{theme}
16 | @{body}
17 |
18 |
--------------------------------------------------------------------------------
/themes/themes/green/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | @{import('meta', 'head', '~common.css', 'default.css')}
13 |
14 |
15 | THEME: @{theme}
16 | @{body}
17 |
18 |
--------------------------------------------------------------------------------
/totaljs_vuejs/client/src/services/TutorialDataService.js:
--------------------------------------------------------------------------------
1 | import http from "../http-common";
2 |
3 | class TutorialDataService {
4 | getAll() {
5 | return http.get("/tutorials");
6 | }
7 |
8 | get(id) {
9 | return http.get(`/tutorials/${id}`);
10 | }
11 |
12 | create(data) {
13 | return http.post("/tutorials", data);
14 | }
15 |
16 | update(id, data) {
17 | return http.put(`/tutorials/${id}`, data);
18 | }
19 |
20 | delete(id) {
21 | return http.delete(`/tutorials/${id}`);
22 | }
23 |
24 | deleteAll() {
25 | return http.delete(`/tutorials`);
26 | }
27 |
28 | findByTitle(title) {
29 | return http.get(`/tutorials?title=${title}`);
30 | }
31 | }
32 |
33 | export default new TutorialDataService();
34 |
--------------------------------------------------------------------------------
/graphql/public/css/default.css:
--------------------------------------------------------------------------------
1 | /*auto*/
2 |
3 | $color : #67B13D;
4 |
5 | body { padding: 0; margin: 0; font: normal 14px Arial; color: #656D78; background-color: #67B13D; line-height: 20px; }
6 |
7 | .container-background { background-color: #FFF; }
8 | .container { margin:0 auto; width: 960px; padding: 50px 0; }
9 |
10 | .center { text-align: center; }
11 | hr { border: 0; border-top: 1px solid #E0E0E0; }
12 |
13 | .linkbutton { display: inline-block; position: relative; padding: 15px 80px; color: $color; border: 1px solid $color; text-decoration: none; border-radius: 4px; }
14 | .linkbutton:hover { color: #FFF; background-color: $color; text-decoration: none; }
15 |
16 | footer { color: #FFF; text-align: center; margin-top: 20px; }
--------------------------------------------------------------------------------
/scheduler/controllers/default.js:
--------------------------------------------------------------------------------
1 | var counter = 0;
2 | var planned = 0;
3 |
4 | exports.install = function() {
5 |
6 | ROUTE('GET /', plain_index);
7 |
8 | // Planned scheduler:
9 | // Each day at 12:00
10 | SCHEDULE('12:00', '1 day', function() {
11 | planned++;
12 | });
13 |
14 | // Onetime at 12:00
15 | SCHEDULE('12:00', function() {
16 | planned++;
17 | });
18 |
19 | // Each 5 minutes and start at 12:00
20 | SCHEDULE('12:00', '5 minutes', function() {
21 | planned++;
22 | });
23 |
24 | };
25 |
26 | // This event is triggered every 60 seconds.
27 | ON('service', function() {
28 | counter++;
29 | });
30 |
31 | function plain_index() {
32 | this.plain('Scheduler run counter: ' + counter + ', planned: ' + planned);
33 | }
--------------------------------------------------------------------------------
/totaljs_vuejs/client/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total.js Tutorials
5 |
6 |
7 | Tutorials
8 |
9 |
10 | Add
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
--------------------------------------------------------------------------------
/static-file-handling/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 | Handling static files
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Resize all images for 50%
16 |
17 | GIF
18 |
19 |
20 | PNG
21 |
22 | @{image('man.png')}
23 |
24 | JPG
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/totaljs_vuejs/client/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | vue-js-client-crud
9 |
10 |
11 |
12 |
13 | We're sorry but vue-js-client-crud doesn't work properly without JavaScript enabled. Please enable it to continue.
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/components/components/datetime.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/cookies/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /get/', cookie_get);
3 | ROUTE('GET /set/', cookie_set);
4 | };
5 |
6 | function cookie_get() {
7 | var self = this;
8 | self.plain('Cookie example\nread test1: ' + (self.cookie('test1') || 'null') + '\nread test2: ' + (self.cookie('test2') || 'null'));
9 | }
10 |
11 | function cookie_set() {
12 | var self = this;
13 |
14 | self.cookie('test1', 'value 1', '2 days');
15 | self.cookie('test2', 'value 2', new Date().add('day', 1));
16 |
17 | // options.domain
18 | // options.path
19 | // options.secure
20 | // options.httponly
21 | // self.res.cookie(name, value, expire, [options]);
22 |
23 | //self.plain('Cookie example, write: ' + value);
24 | self.redirect('/get/');
25 | }
--------------------------------------------------------------------------------
/flowstream/public/windows/dashboard.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | tmp/
2 |
3 | # Logs
4 | logs
5 | *.log
6 |
7 | # Runtime data
8 | pids
9 | *.pid
10 | *.seed
11 |
12 | # Directory for instrumented libs generated by jscoverage/JSCover
13 | lib-cov
14 |
15 | # Coverage directory used by tools like istanbul
16 | coverage
17 |
18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19 | .grunt
20 |
21 | # Compiled binary addons (http://nodejs.org/api/addons.html)
22 | build/Release
23 |
24 | # Dependency directory
25 | # Commenting this out is preferred by some people, see
26 | # https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
27 | node_modules
28 |
29 | # Users Environment Variables
30 | .lock-wscript
31 | index.js.json
32 |
33 | .DS_Store
34 | index.js.json
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/emp-add-edit/emp-add-edit.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { EmpAddEditComponent } from './emp-add-edit.component';
4 |
5 | describe('EmpAddEditComponent', () => {
6 | let component: EmpAddEditComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ EmpAddEditComponent ]
12 | })
13 | .compileComponents();
14 |
15 | fixture = TestBed.createComponent(EmpAddEditComponent);
16 | component = fixture.componentInstance;
17 | fixture.detectChanges();
18 | });
19 |
20 | it('should create', () => {
21 | expect(component).toBeTruthy();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/views-xhr/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | My Site
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 | @{body}
17 |
18 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/blocks/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 | Blocks
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | @{if url === '/admin/'}
14 | @{import('admin.css', 'admin.js')}
15 | @{else}
16 | @{import('style.css', 'script.js')}
17 | @{fi}
18 |
19 |
20 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tms/jsonschemas/jsonschema-users.json:
--------------------------------------------------------------------------------
1 | {
2 | "$id": "https://example.com/address.schema.json",
3 | "$schema": "https://json-schema.org/draft/2020-12/schema",
4 | "description": "Example schema for TMS example",
5 | "type": "object",
6 | "properties": {
7 | "id": {
8 | "type": "string"
9 | },
10 | "name": {
11 | "type": "string"
12 | },
13 | "email": {
14 | "type": "string"
15 | },
16 | "age": {
17 | "type": "number"
18 | },
19 | "roles": {
20 | "type": "array",
21 | "items": {
22 | "type": "string"
23 | }
24 | },
25 | "dtcreated": {
26 | "type": "date"
27 | },
28 | "dtupdated": {
29 | "type": "date"
30 | }
31 | },
32 | "required": ["name", "email"]
33 | }
34 |
--------------------------------------------------------------------------------
/localization/definitions/localization.js:
--------------------------------------------------------------------------------
1 | var COOKIE = '__language';
2 | var allowed = { sk: true, en: true, cz: true };
3 |
4 | LOCALIZE(function(req, res) {
5 |
6 | var language = req.query.language;
7 |
8 | // Set the language according to the querystring and store to the cookie
9 | if (language) {
10 | if (!allowed[language])
11 | return 'en';
12 | res.cookie(COOKIE, language, '2 days');
13 | return language;
14 | }
15 |
16 | language = req.cookie(COOKIE);
17 | if (language)
18 | return allowed[language] ? language : 'en';
19 |
20 | // Sets the language according to user-agent
21 | language = req.language;
22 |
23 | if (language.indexOf('sk') > -1)
24 | return 'sk';
25 |
26 | if (language.indexOf('cz') > -1)
27 | return 'cz';
28 |
29 | return 'en';
30 | });
--------------------------------------------------------------------------------
/routing-resize/definitions/resize.js:
--------------------------------------------------------------------------------
1 | RESIZE('/img/small/', function(image) {
2 | image.resize(100, 100);
3 | image.quality(90);
4 | image.minify();
5 | }, ['/img/']);
6 |
7 | RESIZE('/img/grayscale/', function(image) {
8 | image.grayscale();
9 | }, ['/img/', 'nocache']);
10 |
11 | RESIZE('/img/filters/', function(image) {
12 | image.blur(1);
13 | image.sepia();
14 | image.flip();
15 | image.flop();
16 | }, ['/img/']);
17 |
18 | RESIZE('/img/50percent/', function(image) {
19 | image.resize('50%');
20 | }, ['/img/']);
21 |
22 | RESIZE('/img/medium/', function(image) {
23 | image.resize('70%');
24 | }, ['/img/', '.png']);
25 |
26 | RESIZE('/img/blur/', function(image) {
27 | image.resize(100, 100);
28 | image.quality(90);
29 | image.blur(1);
30 | image.minify();
31 | }, ['~' + PATH.root()]);
--------------------------------------------------------------------------------
/server-sent-events/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /');
3 | ROUTE('GET /sse/', serversentevents, ['sse']);
4 | };
5 |
6 | function serversentevents() {
7 |
8 | var self = this;
9 | var lasteventid = self.sseID || '0';
10 | var counter = U.parseInt(lasteventid);
11 | var indexer = 0;
12 |
13 | var interval = setInterval(function() {
14 |
15 | // Closes client after 10 seconds
16 | if (indexer++ > 10) {
17 | self.close();
18 | clearInterval(interval);
19 | } else {
20 | // Sends data to the client
21 | if (!self.sse({ counter: counter++, message: GUID() }, null, counter)) {
22 | // Something wrong
23 | clearInterval(interval);
24 | }
25 | }
26 |
27 | }, 1000);
28 |
29 | // self.res.on('close', () => console.log('Client is closed'));
30 | }
--------------------------------------------------------------------------------
/serverless/serverless.yml:
--------------------------------------------------------------------------------
1 | # Welcome to serverless. Read the docs
2 | # https://serverless.com/framework/docs/
3 |
4 | # Serverless.yml is the configuration the CLI
5 | # uses to deploy your code to your provider of choice
6 |
7 | # The `service` block is the name of the service
8 | service: lambda
9 |
10 | frameworkVersion: '2'
11 |
12 | # The `provider` block defines where your service will be deployed
13 | provider:
14 | name: aws
15 | runtime: nodejs12.x
16 | region: ap-southeast-1
17 | lambdaHashingVersion: 20201221
18 | # The `functions` block defines what code to deploy
19 | functions:
20 | app:
21 | handler: index.handler
22 | events:
23 | - http: ANY /
24 | - http: 'ANY /{proxy+}'
25 |
26 | # Remove serverless-offline plugin when deploy
27 | plugins:
28 | - serverless-offline
29 |
--------------------------------------------------------------------------------
/totaljs_angular/client/src/app/services/employee.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 |
5 | @Injectable({
6 | providedIn: 'root',
7 | })
8 | export class EmployeeService {
9 | constructor(private _http: HttpClient) {}
10 |
11 | addEmployee(data: any): Observable {
12 | return this._http.post('/api/employees/create', data);
13 | }
14 |
15 | updateEmployee(id: string, data: any): Observable {
16 | return this._http.put(`/api/employees/update/${id}`, data);
17 | }
18 |
19 | getEmployeeList(): Observable {
20 | return this._http.get('/api/employees');
21 | }
22 |
23 | deleteEmployee(id: string): Observable {
24 | return this._http.delete(`/api/employees/remove/${id}`);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/upload-multipart/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
21 | @{body}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/views/views/layout_new.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 |
19 | New Layout
20 | @{body}
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/tms/controllers/api.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 |
3 | // Total.js API - https://docs.totaljs.com/total4/407ff001jy51c/#api-routing
4 | // ROUTE('API /api/ -users_query *Users --> query');
5 | // ROUTE('API /api/ -users_read/id *Users --> read');
6 | // ROUTE('API /api/ +users_insert/id *Users --> insert');
7 | // ROUTE('API /api/ +users_update/id *Users --> update');
8 | // ROUTE('API /api/ -users_remove/id *Users --> remove');
9 |
10 | // REST API
11 | ROUTE('GET /api/users/ *Users --> query');
12 | ROUTE('GET /api/users/{id}/ *Users --> read');
13 | ROUTE('POST /api/users/ *Users --> insert');
14 | ROUTE('PUT /api/users/{id}/ *Users --> update');
15 | ROUTE('DELETE /api/users/{id}/ *Users --> remove');
16 |
17 | };
--------------------------------------------------------------------------------
/websocket/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
21 | @{body}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/localization-external/public/multiple.json:
--------------------------------------------------------------------------------
1 | {
2 | "sk": [
3 | { "id": "T1bx8wg2", "value": "Vitajte" },
4 | { "id": "T1sghbn7", "value": "Správa:" },
5 | { "id": "T121zmsb", "value": "Vybraná lokalizácia bola uložená do cookie." },
6 | { "id": "message", "value": "Toto je správa z sk.resource" }
7 | ],
8 | "cz": [
9 | { "id": "T1bx8wg2", "value": "Vítejte" },
10 | { "id": "T1sghbn7", "value": "Zpráva:" },
11 | { "id": "T121zmsb", "value": "Zvolená lokalizace byla uložena do cookie." },
12 | { "id": "message", "value": "Toto je zpráva z cz.resource" }
13 | ],
14 | "en": [
15 | { "id": "T1bx8wg2", "value": "Welcome" },
16 | { "id": "T1sghbn7", "value": "Message:" },
17 | { "id": "T121zmsb", "value": "The selected localization has been stored into the cookie." },
18 | { "id": "message", "value": "This is the message from en.resource" }
19 | ]
20 | }
--------------------------------------------------------------------------------
/flowstream/databases/flow/counter.html:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 | Without settings
30 |
31 |
32 |
33 |
34 | Counter
35 |
36 |
--------------------------------------------------------------------------------
/validation/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 | @{body}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/pagination/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pagination
5 |
6 |
7 |
8 |
9 |
10 |
11 |
19 |
20 |
21 |
22 | @{body}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/remote-terminal/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 |
7 | Remote terminal
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/localization/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
13 |
14 |
15 |
16 |
21 |
22 |
23 | @{body}
24 | @(Message:) …
25 |
26 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/localization-external/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
13 |
14 |
15 |
16 |
21 |
22 |
23 | @{body}
24 | @(Message:) …
25 |
26 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/views-custom-helper/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
19 |
20 | Current date/time: @{helper('now')}
21 |
22 | @{body}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/controller-memorize/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 | In layout: @{repository.ticks}
19 |
20 | @{body}
21 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/livereload/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | options.livereload = true;
9 |
10 | /*
11 | // A port number for live reload
12 | options.livereload = 35729;
13 | */
14 |
15 | /*
16 | // A custom port number for live reload
17 | options.livereload = 35729;
18 | */
19 |
20 | /*
21 | // A hostname for live reload on the SERVER-SIDE
22 | // Total.js will use the "livereload.totaljs.com" service, but you need to specify a hostname in the form:
23 | options.livereload = 'www.totaljs.com';
24 | // uses "location.origin" value as the hostname identifier
25 | */
26 |
27 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
28 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/flowstream/databases/flow/datetime.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
27 |
28 |
29 |
30 | Without settings
31 |
32 |
33 |
34 |
35 | DateTime
36 |
37 |
--------------------------------------------------------------------------------
/email-send/index.js:
--------------------------------------------------------------------------------
1 | require('total.js');
2 |
3 | var message = new Mail.Message('Subject', 'Body');
4 |
5 | message.to('petersirka@gmail.com');
6 |
7 | // message.cc('@');
8 | // message.bcc('@');
9 | // message.reply('@');
10 | // message.attachment('/filename.txt', 'name.txt');
11 |
12 | message.from('jankohrasko@gmail.com', 'Janko Hrasko');
13 |
14 | Mail.on('error', function (err) {
15 | console.log(err);
16 | });
17 |
18 | // SEND via GMAIL
19 | // message.send('smtp.gmail.com', { port: 465, secure: true, user: 'ENTER_YOUR_EMAIL', password: 'ENTER_YOUR_PASSWORD' });
20 | // SOLUTION [Error: SELF_SIGNED_CERT_IN_CHAIN]: message.send('smtp.gmail.com', { port: 465, secure: true, user: 'ENTER_YOUR_EMAIL', password: 'ENTER_YOUR_PASSWORD', rejectUnauthorized: true });
21 |
22 | // SEND via AUTH BASIC SMTP
23 | // message.send('smtp.yourdomain.com', { user: 'ENTER_YOUR_EMAIL', password: 'ENTER_YOUR_PASSWORD' });
24 |
25 | // SEND via SMTP
26 | message.send('smtp.yourdomain.com');
--------------------------------------------------------------------------------
/totaljs_react/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-client",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.17.0",
7 | "@testing-library/react": "^13.4.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "http-proxy-middleware": "^2.0.6",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-scripts": "5.0.1",
13 | "web-vitals": "^2.1.4"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test",
19 | "eject": "react-scripts eject"
20 | },
21 | "eslintConfig": {
22 | "extends": [
23 | "react-app",
24 | "react-app/jest"
25 | ]
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/flowstream/databases/flow/console.html:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 | Without settings
28 |
29 |
30 |
31 |
32 | Console
33 |
36 |
--------------------------------------------------------------------------------
/threads/index.js:
--------------------------------------------------------------------------------
1 | const options = {};
2 |
3 | // options.ip = '127.0.0.1';
4 | // options.port = parseInt(process.argv[2]);
5 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
6 | // options.config = { name: 'Total.js' };
7 | // options.sleep = 3000;
8 | // options.inspector = 9229;
9 | // options.watch = ['private'];
10 | // options.livereload = 'https://yourhostname';
11 |
12 | // Enables cluster:
13 | // options.cluster = 'auto';
14 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
15 |
16 | // Enables threads:
17 | options.cluster = 'auto';
18 | options.logs = 'isolated';
19 |
20 | options.threads = true;
21 | // or add prefix to endpoints:
22 | // options.threads = '/api/';
23 |
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/authorization/schemas/users.js:
--------------------------------------------------------------------------------
1 | NEWSCHEMA('Users', function(schema) {
2 |
3 | schema.define('email', 'Email', true);
4 | schema.define('password', 'String(30)', true);
5 |
6 | // Performs login
7 | schema.action('login', {
8 | name: 'Login',
9 | action: function($, model){
10 | var builder = DATA.read('nosql/users');
11 | builder.where('email', model.email);
12 | builder.where('password', model.password);
13 | builder.callback(function(err, user) {
14 | if (!user) {
15 | $.invalid('error-users-404');
16 | return;
17 | }
18 |
19 | // Creates a cookie and session item
20 | MAIN.session.authcookie($, UID(), user.id, '3 days');
21 |
22 | // Writes audit
23 | $.audit(user.id + ': ' + user.name);
24 | $.success();
25 | });
26 | }
27 | });
28 |
29 | // Performs logout
30 | schema.action('logout', {
31 | name: 'Logout',
32 | action: function($) {
33 |
34 | // Removes session
35 | MAIN.session.logout($);
36 |
37 | // Performs a redirect
38 | $.redirect('/');
39 | }
40 | });
41 | });
--------------------------------------------------------------------------------
/graphql/controllers/default.js:
--------------------------------------------------------------------------------
1 | const graphqlHTTP = require('express-graphql').graphqlHTTP;
2 | const makeExecutableSchema = require('@graphql-tools/schema').makeExecutableSchema;
3 |
4 | const typeDefs = `
5 | type User {
6 | id:Int
7 | email: String!
8 | name: String
9 | }
10 |
11 | type Query {
12 | allUsers: [User!]!
13 | }
14 | `;
15 |
16 | const resolvers = {
17 | Query: {
18 | allUsers: () => {
19 | return new Promise(function (resolve, reject) {
20 | NOSQL('user').find().callback((err, response) => !err ? resolve(response) : reject(Error(err)))
21 | })
22 | }
23 | }
24 | };
25 |
26 | const schema = makeExecutableSchema({
27 | resolvers,
28 | typeDefs,
29 | });
30 |
31 | exports.install = function () {
32 | ROUTE('GET /');
33 |
34 | ROUTE('GET /graphql', async function () {
35 | await graphqlHTTP({ schema: schema, graphiql: true })(this.req, this.res);
36 | });
37 |
38 | ROUTE('POST /graphql', async function () {
39 | await graphqlHTTP({ schema: schema, graphiql: false })(this.req, this.res);
40 | });
41 | }
42 |
--------------------------------------------------------------------------------
/totaljs_angular/client/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": true,
9 | "noImplicitOverride": true,
10 | "noPropertyAccessFromIndexSignature": true,
11 | "noImplicitReturns": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "sourceMap": true,
14 | "declaration": false,
15 | "downlevelIteration": true,
16 | "experimentalDecorators": true,
17 | "moduleResolution": "node",
18 | "importHelpers": true,
19 | "target": "ES2022",
20 | "module": "ES2022",
21 | "useDefineForClassFields": false,
22 | "lib": [
23 | "ES2022",
24 | "dom"
25 | ]
26 | },
27 | "angularCompilerOptions": {
28 | "enableI18nLegacyMessageIdFormat": false,
29 | "strictInjectionParameters": true,
30 | "strictInputAccessModifiers": true,
31 | "strictTemplates": true
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/sitemap/views/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @{meta}
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 | HOMEPAGE
19 | TERMS
20 | PRIVACY
21 | CONTACT
22 |
23 |
24 |
25 | Breadcrumb:
26 | @{foreach m in sitemap()}
27 |
@{m.name}
28 | @{if !m.last}
29 | >
30 | @{fi}
31 | @{end}
32 |
33 |
34 | @{body}
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/totaljs_vuejs/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-js-client-crud",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "axios": "^0.19.0",
12 | "core-js": "^3.4.3",
13 | "vue": "^2.6.10",
14 | "vue-router": "^3.1.3"
15 | },
16 | "devDependencies": {
17 | "@vue/cli-plugin-babel": "^4.1.0",
18 | "@vue/cli-plugin-eslint": "^4.1.0",
19 | "@vue/cli-service": "^4.1.0",
20 | "babel-eslint": "^10.0.3",
21 | "eslint": "^5.16.0",
22 | "eslint-plugin-vue": "^5.0.0",
23 | "vue-template-compiler": "^2.6.10"
24 | },
25 | "eslintConfig": {
26 | "root": true,
27 | "env": {
28 | "node": true
29 | },
30 | "extends": [
31 | "plugin:vue/essential",
32 | "eslint:recommended"
33 | ],
34 | "rules": {
35 | "no-console": "off"
36 | },
37 | "parserOptions": {
38 | "parser": "babel-eslint"
39 | }
40 | },
41 | "browserslist": [
42 | "> 1%",
43 | "last 2 versions"
44 | ]
45 | }
46 |
--------------------------------------------------------------------------------
/localization-external/definitions/localization.js:
--------------------------------------------------------------------------------
1 | var COOKIE = '__language';
2 | var allowed = { sk: true, en: true, cz: true };
3 |
4 | LOCALIZE(function(req, res) {
5 |
6 | var language = req.query.language;
7 |
8 | // Set the language according to the querystring and store to the cookie
9 | if (language) {
10 | if (!allowed[language])
11 | return 'en';
12 | res.cookie(COOKIE, language, '2 days');
13 | return language;
14 | }
15 |
16 | language = req.cookie(COOKIE);
17 | if (language)
18 | return allowed[language] ? language : 'en';
19 |
20 | // Sets the language according to user-agent
21 | language = req.language;
22 |
23 | if (language.indexOf('sk') > -1)
24 | return 'sk';
25 |
26 | if (language.indexOf('cz') > -1)
27 | return 'cz';
28 |
29 | return 'en';
30 | });
31 |
32 | ON('ready', function() {
33 |
34 | // The method downloads multiple resources at once
35 | LOADRESOURCE('http://{ip}:{port}/multiple.json'.args(F));
36 |
37 | // The method downloads only the one resource
38 | // LOADRESOURCE('sk', 'http://{ip}:{port}/sk.json'.args(F));
39 |
40 | });
--------------------------------------------------------------------------------
/views/views/index.html:
--------------------------------------------------------------------------------
1 | @{meta('Homepage')}
2 |
3 | @{section footer}
4 |
5 | THIS IS FOOTER IN LAYOUT
6 | @{end}
7 |
8 | @{helper address(city, street)}
9 |
10 | @{city}
11 | @{street}
12 |
13 | @{end}
14 |
15 | Welcome!
16 | partial.html in view → @{view('partial')}
17 |
18 | @{if Date.now() % 2 == 0}
19 | @{view('dynamic')}
20 | @{fi}
21 |
22 | @{if (1 === 1)}
23 |
24 | VIEW ENGINE
25 | Title: @{title}
26 |
27 | @{else}
28 |
29 | HA HA HA
30 |
31 | @{endif}
32 |
33 | Dynamic view
34 |
35 | @{view_compile('Current date: @{model.format(\'dd.MM.yyyy HH:mm\')}', new Date())}
36 |
37 | Foreach
38 |
39 | @{foreach m in [1, 2, 3, 4]}
40 | @{m} - @{index}
41 | @{end}
42 |
43 |
44 |
45 |
46 | Inline helper
47 |
48 | Address 1:
49 | @{address('Slovakia', 'Teplicka')}
50 |
51 | Address 2:
52 | @{address('Germany', 'Berlin')}
--------------------------------------------------------------------------------
/server-sent-events/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 | Server-Sent Events
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/livereload/views/index.html:
--------------------------------------------------------------------------------
1 | @{layout('')}
2 |
3 |
4 |
5 |
6 | Live reload
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
22 |
23 |
24 |
25 | Update something
26 | Model: @{model.name}
27 |
28 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/flowstream/databases/flow/trigger.html:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
24 |
28 |
29 |
30 |
31 | Without settings
32 |
33 |
34 |
35 |
36 | Trigger
37 | Run
38 |
--------------------------------------------------------------------------------
/xml-sitemap/controllers/default.js:
--------------------------------------------------------------------------------
1 | exports.install = function() {
2 | ROUTE('GET /', view_index);
3 | ROUTE('FILE /sitemap.xml', file_xml);
4 | };
5 |
6 | function view_index() {
7 | var self = this;
8 | self.plain(self.hostname('sitemap.xml'));
9 | }
10 |
11 | function file_xml(req, res) {
12 |
13 | var hostname = req.hostname();
14 | var lastmod = NOW.format('yyyy-MM-dd');
15 |
16 | var write = function(url, lastmod, priority, changefreq) {
17 | var str = '' + url.encode() + ' ' + lastmod + ' ' + changefreq + ' ' + priority + ' ';
18 | res.write(str);
19 | };
20 |
21 | res.writeHead(200, { 'Content-Type': 'text/xml' });
22 | res.write('');
23 |
24 | // Use workers for larger sitemaps
25 |
26 | write(hostname + '/', lastmod, '1.0000', 'weekly');
27 | write(hostname + '/products/', lastmod, '0.3', 'monthly');
28 | write(hostname + '/contact/', lastmod, '0.3', 'monthly');
29 |
30 | res.write(' ');
31 | res.end();
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/cors/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/views/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/blocks/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/components/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/cookies/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/middleware/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/pagination/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/postgresql/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/routing/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/scheduler/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/sitemap/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/themes/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/validation/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/versions/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/views-xhr/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/websocket/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/workers/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/configuration/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/controller-mail/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/custom-headers/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/download-file/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/download-stream/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/image-resize/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/image-watermark/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/localization/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/querybuilderpg/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/redirect-host/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/remote-terminal/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/routing-resize/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/totaljs_angular/client/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3 | "version": "2.0.0",
4 | "tasks": [
5 | {
6 | "type": "npm",
7 | "script": "start",
8 | "isBackground": true,
9 | "problemMatcher": {
10 | "owner": "typescript",
11 | "pattern": "$tsc",
12 | "background": {
13 | "activeOnStart": true,
14 | "beginsPattern": {
15 | "regexp": "(.*?)"
16 | },
17 | "endsPattern": {
18 | "regexp": "bundle generation complete"
19 | }
20 | }
21 | }
22 | },
23 | {
24 | "type": "npm",
25 | "script": "test",
26 | "isBackground": true,
27 | "problemMatcher": {
28 | "owner": "typescript",
29 | "pattern": "$tsc",
30 | "background": {
31 | "activeOnStart": true,
32 | "beginsPattern": {
33 | "regexp": "(.*?)"
34 | },
35 | "endsPattern": {
36 | "regexp": "bundle generation complete"
37 | }
38 | }
39 | }
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/video-streaming/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/views-websocket/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/xml-sitemap/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/assertion-testing/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/controller-memorize/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/querybuildermysql/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/request-to-response/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/server-sent-events/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/static-file-handling/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/static-file-merge/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/upload-multipart/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/views-custom-helper/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/views-place-sections/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/xml-sitemap-workers/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/authorization-www-basic/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/download-file-counter/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/image-middleware-pngquant/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/localization-external/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | // options.cluster = 'auto';
19 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
20 |
21 | // Enables threads:
22 | // options.cluster = 'auto';
23 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
24 | // options.timeout = 5000;
25 | // options.threads = '/api/';
26 | // options.logs = 'isolated';
27 |
28 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
29 | require('total4/' + type)(options);
--------------------------------------------------------------------------------
/tms/readme.md:
--------------------------------------------------------------------------------
1 | # TMS example
2 |
3 | Simple example app for __Total Messaging Service (TMS)__.
4 |
5 | ## Usage
6 | Main logic of application is inside `users` schema (`schemas/users.js`). Declared array `USERS` represents database or storage of created users. You can list/read/create/update/remove users with REST API or Total's API routing.
7 |
8 | ## Usage - TMS
9 | All TMS declaration are inside `definitions/tms.js`. You can connect to app's TMS with our [Flowstream](https://github.com/totaljs/flowstream). Default TMS route path is `/$tms/` but can be changed with property `default_tms_url` inside `config` file.
10 |
11 | [`NEWPUBLISH()`](https://docs.totaljs.com/total4/407ff001jy51c/#a6eb9001fo51c) and [`NEWSUBSCRIBE()`](https://docs.totaljs.com/total4/407ff001jy51c/#a6eb8001bp51c) has multiple ways of declaration so you can pick which one you like. You can subscribe to events `users_insert`, `users_update` and `users_remove` with [`SUBSCRIBE()`](https://docs.totaljs.com/total4/407ff001jy51c/#a6ec1001uu51c).
12 | When someone create new user your TMS subscribe `users_insert` will recieve message with this object.
13 |
14 | 
--------------------------------------------------------------------------------
/cluster/index.js:
--------------------------------------------------------------------------------
1 | // ===================================================
2 | // Total.js start script
3 | // https://www.totaljs.com
4 | // ===================================================
5 |
6 | const options = {};
7 |
8 | // options.ip = '127.0.0.1';
9 | // options.port = parseInt(process.argv[2]);
10 | // options.unixsocket = require('path').join(require('os').tmpdir(), 'app_name');
11 | // options.config = { name: 'Total.js' };
12 | // options.sleep = 3000;
13 | // options.inspector = 9229;
14 | // options.watch = ['private'];
15 | // options.livereload = 'https://yourhostname';
16 |
17 | // Enables cluster:
18 | options.cluster = 5;
19 | // options.cluster = 'auto';
20 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
21 |
22 | // Enables threads:
23 | // options.cluster = 'auto';
24 | // options.cluster_limit = 10; // max 10. threads (works only with "auto" scaling)
25 | // options.timeout = 5000;
26 | // options.threads = '/api/';
27 | // options.logs = 'isolated';
28 |
29 | var type = process.argv.indexOf('--release', 1) !== -1 || process.argv.indexOf('release', 1) !== -1 ? 'release' : 'debug';
30 | require('total4/' + type)(options);
--------------------------------------------------------------------------------