Total.js V4 0.0.99
The previous Total.js framework for Node.js. Use this documentation to maintain applications built with Total.js 4.
Getting started
-
Introduction
Total.js 4 is a full-stack framework for Node.js written in pure JavaScript, with no dependencies.
-
Installation and first app
Install Total.js 4, write the start script and answer your first requests.
-
Configuration
How Total.js loads the config files and .env files, how values are parsed, and how to read and change them through CONF.
Reference 51 -
Application structure and modes
Which directories Total.js 4 loads and in which order, debug and release modes, bundles, packages and workers.
Reference 36 -
Testing
Run groups of tests with TESTER() and send virtual requests to your routes with TEST() and ACTION().
Reference 6 -
Command line (total4)
The total4 command-line tool: creating projects, serving a folder, bundles, minifying and localization resources.
Reference 20
Web server
-
Routing
Methods, dynamic parameters, signed-in users, schemas, API routes, views and flags of ROUTE().
Reference 2 -
Controllers
The controller is
Reference 139thisin every route action: it holds the request data and answers the request. -
Schemas and actions
Declare schemas with typed and validated fields, write operations and actions, use the $ object and call them from routes and code.
Reference 72 -
Views
HTML templates in views/: expressions, conditions, loops, layouts, partials, sections, helpers and localization.
Reference 46 -
Middleware
Run code before routes and files with MIDDLEWARE(), in a route or for many routes at once with USE().
Reference 10 -
Static files
Serve the public directory, build the URLs of static files, map, merge and resize files, answer with file routes and localize static files.
Reference 34 -
WebSockets
Declare WebSocket routes, handle clients and messages in the WebSocket controller, and connect to WebSocket servers with WEBSOCKETCLIENT().
Reference 53 -
Localization
Translate views, static files, errors and e-mails with resource files and a language for each request.
Reference 40 -
Operations and tasks
Reusable business logic with operations, chained operations, tasks with steps, commands, extensions and PROMISIFY().
Reference 44 -
JSON schemas
Validate and convert data with JSON schemas: files in jsonschemas/, inline declarations and actions.
Reference 35 -
HTTP server: CORS, proxy and errors
Start the HTTP server, allow cross-origin requests, forward and redirect requests, and design error pages.
Reference 28 -
Sitemap
Describe the pages of a website in the sitemap file and use it for navigation and breadcrumbs.
Reference 16
Security
-
Authorization and sessions
Sign in requests with the AUTH() delegate, limit routes with the + and - flags, and keep sessions in cookies, tokens or the SESSION() store.
Reference 40 -
Encryption
Encrypt values with ENCRYPT() and DECRYPT(), bind them to the browser of a request with ENCRYPTREQ() and DECRYPTREQ(), and set the secret.
Reference 5
Data
-
NoSQL database
The embedded file database of Total.js 4: NOSQL() for JSON documents and TABLE() for rows with a schema, both stored in the databases/ folder and queried with the same builder.
Reference 55 -
File storage
Save, read, serve and manage binary files with FILESTORAGE().
Reference 37 -
QueryBuilder
Query SQL databases with DATA, DB() and the QueryBuilder, and connect your database with an adapter registered by NEWDB().
Reference 50 -
Cache, counters and small stores
Keep values in the in-memory cache, in files and in preferences, count statistics, and back up folders.
Reference 34
Integrations
-
HTTP requests
Call other HTTP services with RESTBuilder, REQUEST() and DOWNLOAD().
Reference 54 -
Sending email
Send email from views, HTML or logs with the SMTP server of the configuration, and send messages to any server with the Mail module.
Reference 40 -
Message Service and APIs
Publish, receive and call over the Total.js Message Service, connect with TMSCLIENT(), call APIs with API() and NEWAPI(), and expose API routes.
Reference 37 -
OpenClient
OPENCLIENT(): a WebSocket client for messages to other services.
Processes and events
-
Scheduling and events
Run jobs at a time, by cron or every few minutes, and react to framework events with ON() and EMIT().
Reference 46 -
FlowStream
Run graphs of components from .flow files in /flowstreams/, write components and work with messages and FlowStream instances.
Reference 49 -
Workers, threads and cluster
Run code in worker threads and child processes, run shell commands, and run the app as a cluster or as separate threads.
Reference 36
Utilities
-
Utilities
Global helpers and the U object: identifiers, object copies, paths, files, queues and text functions.
Reference 130 -
Prototypes
Methods that Total.js 4 adds to strings, numbers, dates and arrays.
Reference 114 -
Images
Resize, crop, convert and measure images with the Image module and GraphicsMagick or ImageMagick.
Reference 47
Modules
-
LDAP
Read entries from an LDAP server such as Active Directory with LDAP().
Reference 1 -
Markdown
Convert Markdown to HTML with String.markdown() and choose what it produces with its options.
Reference 7 -
HTML parser
Parse HTML on the server into a tree of nodes that you can search and change.
Reference 19 -
Macros
Compile a small rule language into a function with NEWMACRO(), for rules that users write.
Reference 2 -
CMS compiler
Compile pages made with the Total.js CMS editor and render them with their widgets.
Reference 7 -
UI Builder compiler
Prepare a schema of the UI Builder designer for production with F.uibuildercompiler().
Reference 1 -
Tangular
The Tangular template engine: compile and render templates and use its helpers.
Reference 11