Skip to content

Latest commit

 

History

History
76 lines (53 loc) · 1.28 KB

File metadata and controls

76 lines (53 loc) · 1.28 KB

Installation

Requirements

  • Node.js 18 or newer
  • npm, pnpm, or yarn

Framework Install

npm install triva

Minimal Smoke Test

import { build } from 'triva';

const app = new build({ env: 'development' });

app.get('/', (req, res) => {
  res.send('Triva is installed');
});

app.listen(3000);

Run the file and open http://localhost:3000.

Optional Extension Packages

Install only the packages you need:

npm install @trivajs/cors
npm install @triva/jwt
npm install @trivajs/cli
npm install @trivajs/shortcuts

Optional Adapter Drivers

Some cache adapters need their own driver package in your app:

  • Redis
  • MongoDB
  • PostgreSQL
  • MySQL
  • SQLite
  • Better-SQLite3
  • Supabase

Start with the adapter overview before wiring one into cache.

HTTPS Note

If you run Triva with protocol: 'https', provide ssl.key and ssl.cert:

import fs from 'fs';
import { build } from 'triva';

const app = new build({
  protocol: 'https',
  ssl: {
    key: fs.readFileSync('./certs/localhost-key.pem'),
    cert: fs.readFileSync('./certs/localhost-cert.pem')
  }
});

Read Next