Total.js Platform
Total.js Platform

Total.js Platform news and tutorials

Differences between Total.js v4 and Total.js v5

Differences between Total.js v5 and Total.js v4

This blog post describes the main differences between Total.js v4 and Total.js v5. Total.js v5 contains almost new and nicely written code. This blog post will be gradually updated.

Projects

Introduction

What is new in Total.js v5?

Only shorter, cleaner and improved code. Finally, the repository contains much nicer code. It’s fully optimised for Node >18.

Should I update the Total.js v4 apps?

No. We started testing Total.js v5. You can develop upcoming projects with Total.js v5. For stability reasons, wait before converting older apps to Total.js v5.

Is the Total.js v5 stable?

Almost yes. We use Total.js v5 in several projects, and they work without critical issues. We are working on unit-tests, documentation, etc..

How can I determine Total.js v5 in the code?

New start script

We updated the start script for Total.js v5. Don't forget to use it if you want to use Total.js v5.

Schemas

Linking schemas:

Partial data:

CALL/EXEC/ACTION:

Routing

Total.js v5 doesn’t use request and response instances. It works only with a controller - alias $. So every request to an action, file or WebSocket is represented as a controller.

Flags:

API routing

New feature

Routes support the ? character which is replaced with CONF.$api value (default: /admin/).

WebSocket routing

Localization

Determine the language of incoming requests:

Common changes

Configuration

Total.js v5 supports only the one configuration file called /config. All system keys (90%) were updated to a shorter version:

Keys: https://github.com/totaljs/framework5/blob/main/index.js#L326

Email

Config:

NoSQL

All NoSQL commands are performed via the Total.js QueryBuilder used in PostgreSQL/MySQL.

PREF

PREF is removed from Total.js v5. You can use MEMORIZE(name) method that contains the same functionality.