Skip to main content

Overview

Features

Client routing with/without SPA transitions

By default, tramvai application is a combination of SSR and SPA approaches - at first request HTML page will be rendered server-side, then any in-app navigations on client-side will be SPA transitions. SpaRouterModule responsible for this behaviour:

import { createApp } from '@tramvai/core';
import { SpaRouterModule } from '@tramvai/module-router';

createApp({
name: 'awesome-app',
modules: [SpaRouterModule],
});

Meanwhile, tramvai application easily can be transformed to multi-page app without SPA transitions, with NoSpaRouterModule:

import { createApp } from '@tramvai/core';
import { NoSpaRouterModule } from '@tramvai/module-router';

createApp({
name: 'awesome-app',
modules: [NoSpaRouterModule],
});

Information about navigation lifecycle is available on Navigation Flow page

Route and Url

Information about Route and Url is available on Working with Url page

Trailing Slash

Router will force all urls to end with slash, e.g. /foo path will be redirected to /foo/.

Merge Slashes

Router will replace several consecutive slashes by single slashes (slashes after protocol are still be with // after protocol name), e.g. /foo///bar/ path will be redirected to /foo/bar/.