- Node.js 18.0.0 or higher
- npm 8.0.0 or higher
node --version
npm --versionnpm install trivaCreate server.js:
import { build, get, listen } from 'triva';
await build({
env: 'development'
});
get('/', (req, res) => {
res.json({ status: 'running' });
});
listen(3000);node server.jsVisit http://localhost:3000 to see your server running.
Install only the adapters you need:
npm install mongodb # MongoDB
npm install pg # PostgreSQL
npm install mysql2 # MySQL
npm install redis # Redis
npm install better-sqlite3 # SQLitenpm install @triva/cors # CORS middleware
npm install @triva/jwt # JWT authentication
npm install @triva/cli # CLI tools
npm install @triva/shortcuts # Developer shortcuts