1.3.0 • Published 5 months ago
@storecraft/database-sqlite v1.3.0
Storecraft SQLite driver
Official SQLite driver for StoreCraft using better-sqlite package.
npm i @storecraft/database-sqliteusage
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { SQLite } from '@storecraft/database-sqlite'
import { migrateToLatest } from '@storecraft/database-sqlite/migrate.js'
const app = new App(
{
auth_admins_emails: ['admin@sc.com'],
}
)
.withPlatform(new NodePlatform())
.withDatabase(
new SQLite(
{
filepath: join(homedir(), 'db.sqlite')
}
)
)
.withStorage(new NodeLocalStorage())
.init();
await migrateToLatest(app.__show_me_everything.db, false);
http.createServer(app.handler).listen(
8000,
() => {
app.print_banner('http://localhost:8000');
}
); Storecraft will search the following env variables
SQLITE_FILEPATH=./data.dbSo, you can instantiate with empty config
.withDatabase(
new SQLite()
)Testing Locally
Simply run tests/runner.test.js
npm run database-sqlite:testAuthor: Tomer Shalev <tomer.shalev@gmail.com>1.0.19
6 months ago
1.0.18
7 months ago
1.0.17
7 months ago
1.0.16
7 months ago
1.2.5
6 months ago
1.3.0
5 months ago
1.0.20
6 months ago
1.0.15
7 months ago
1.0.14
7 months ago
1.0.13
8 months ago
1.0.9
10 months ago
1.0.8
10 months ago
1.0.7
11 months ago
1.0.11
9 months ago
1.0.10
9 months ago
1.0.12
8 months ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago