THT is in early Beta. We welcome contributors & feedback.

Db

Databases are configured in settings/app.jcon.

Entries with a file key will point to a sqlite file in data/db.

{
    app: {
        // ...
    }

    databases: {

        // default sqlite database
        default: {
            file: app.db  // sqlite 
        }

        // exampe of a mysql database
        another: {
            driver: 'mysql',  // or 'pgsql'
            server: 'localhost',
            database: 'example',
            username: 'dbuser',
            password: '12345'
        }
    }
}

All functions use the default database. To point to another database, call Db.use (see below).

THT will automatically connect to each database as needed, and disconnect when the current request ends.