db create

This commit is contained in:
Elijah McMorris 2024-02-15 15:11:46 -08:00
parent 19ae57d449
commit 809fe18090
Signed by: NexVeridian
SSH key fingerprint: SHA256:bsA1SKZxuEcEVHAy3gY1HUeM5ykRJl0U0kQHQn0hMg8
9 changed files with 93 additions and 35 deletions

View file

@ -0,0 +1,23 @@
import { Surreal } from 'surrealdb.js';
require('dotenv');
const db = new Surreal();
export async function initConnection(): Promise<Surreal> {
try {
db.connect(process.env.DB_PORT + '/rpc', {
namespace: 'url',
database: 'url',
auth: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
scope: '',
},
});
} catch (e) {
console.error('ERROR', e);
}
return db;
}