Create a global Neo4j connection instance

This commit is contained in:
Maciej Pędzich 2024-04-27 23:54:35 +02:00
parent 88793ee58d
commit f158026ecd
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
2 changed files with 17 additions and 0 deletions

6
src/db.ts Normal file
View File

@ -0,0 +1,6 @@
import { auth, driver } from 'neo4j-driver';
export const db = driver(
import.meta.env.NEO4J_DB_URI,
auth.basic(import.meta.env.NEO4J_USERNAME, import.meta.env.NEO4J_PASSWORD)
);

11
src/env.d.ts vendored
View File

@ -1 +1,12 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
interface ImportMetaEnv {
readonly NEO4J_DB_URI: string;
readonly NEO4J_USERNAME: string;
readonly NEO4J_PASSWORD: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}