Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storecraft/database-planetscale

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storecraft/database-planetscale

`Storecraft` database driver for `PlanetScale` (cloud mysql)

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
increased by757.14%
Maintainers
0
Weekly downloads
 
Created
Source

Storecraft Planetscale (cloud mysql) Database support



Official Planetscale (cloud MySql) driver for StoreCraft on any platforms.

npm i @storecraft/database-neon

Setup

  • First, login to your planetscale account.
  • Create a database.
  • Copy the connection string.

usage

import 'dotenv/config';
import http from "node:http";
import { join } from "node:path";
import { homedir } from "node:os";

import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/platforms/node';
import { PlanetScale } from '@storecraft/database-planetscale'
import { migrateToLatest } from '@storecraft/database-planetscale/migrate.js'
import { NodeLocalStorage } from '@storecraft/storage-local/node'


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(join(homedir(), 'tomer')))

await app.init();
await migrateToLatest(app.db, false);
 
const server = http.createServer(app.handler).listen(
  8000,
  () => {
    console.log(`Server is running on http://localhost:8000`);
  }
); 

Author: Tomer Shalev <tomer.shalev@gmail.com>

Keywords

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc