1.3.0 • Published 1 month ago
@storecraft/database-planetscale v1.3.0
Storecraft Planetscale (cloud mysql) Database support
Official Planetscale
(cloud MySql) driver for StoreCraft
on any platforms.
npm i @storecraft/database-planetscale
Setup
- First, login to your planetscale account.
- Create a database.
- Copy the
connection string
.
usage
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 { PlanetScale } from '@storecraft/database-planetscale'
import { migrateToLatest } from '@storecraft/database-planetscale/migrate.js'
const app = new App(
{
auth_admins_emails: ['admin@sc.com'],
auth_secret_access_token: 'auth_secret_access_token',
auth_secret_refresh_token: 'auth_secret_refresh_token'
}
)
.withPlatform(new NodePlatform())
.withDatabase(
new PlanetScale(
{
url: process.env.PLANETSCALE_CONNECTION_URL,
useSharedConnection: true
}
)
)
.withStorage(new NodeLocalStorage('storage'))
.init();
await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store.createVectorIndex();
http.createServer(app.handler).listen(
8000,
() => {
app.print_banner('http://localhost:8000');
}
);
Author: Tomer Shalev <tomer.shalev@gmail.com>
1.0.17
2 months ago
1.0.16
3 months ago
1.2.5
2 months ago
1.3.0
1 month ago
1.0.15
3 months ago
1.0.14
3 months ago
1.0.13
3 months ago
1.0.12
3 months ago
1.0.11
4 months ago
1.0.10
4 months ago
1.0.9
4 months ago
1.0.8
5 months ago
1.0.7
5 months ago
1.0.6
6 months ago
1.0.5
8 months ago
1.0.2
9 months ago
1.0.4
9 months ago
1.0.3
9 months ago
1.0.1
9 months ago
1.0.0
10 months ago