Trillo Docs
  • Info
  • Quick Start
  • Concepts
    • Overview
    • Reactivity
    • Indexability
    • Reusability
    • Kits
  • Reference
    • CLI
    • Language
    • Markup
    • Preprocessor
    • Runtime
    • Server
    • Stdlib
Powered by GitBook
On this page
  • Installation
  • Hello World
  • Use in a project

Quick Start

PreviousInfoNextConcepts

Last updated 1 year ago

Installation

Trillo requires Node.js v.16 or higher. If you don't have it on you machine, download it from the and install it before proceeding.

npm install -g trillo

Once installed, we can use the command to start a .

Hello World

mkdir myapp
trillo serve myapp
# ... http://localhost:3000

We can add a simple page...

<!-- myapp/index.html -->
<html>
  <body :count="[[0]]"
        :did-init="[[
          setInterval(() => count++, 1000);
        ]]">
    Seconds: [[count]]
  </body>
</html>

Use in a project

Let's create a demo project:

mkdir myproject
cd myproject
npm init -y
npm install trillo
mkdir docroot

We need to add an entry point with our configuration:

// index.js
const trillo = require('trillo');
const path = require('path');

new trillo.Server({
  port: 3001,
  rootPath: path.join(__dirname, 'docroot'),
});

In TypeScript (or ES6 code) we can use imports instead:

// index.ts
import { Server } from 'trillo';
import path from 'path';

new Server({
  port: 3001,
  rootPath: path.join(__dirname, 'docroot'),
});

We can now create a page in docroot/ like shown above and run the project:

node index.js
# ... START http://localhost:3001

...and open to see the seconds counter live.

When using Trillo in a project we can customize it and add our own services and middleware to the server. All options are documented in the .

Node.js site
trillo serve
development server
http://localhost:3000
Server Reference