Add scripts and fix routes

This commit is contained in:
Owen Schwartz
2024-09-28 14:46:36 -04:00
parent ac6a6d7616
commit 77d71de990
6 changed files with 91 additions and 13 deletions

View File

@@ -2,15 +2,11 @@ import { Request, Response, NextFunction } from 'express';
import { DrizzleError } from 'drizzle-orm';
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
import { sites, Site } from '../../db/schema';
interface CustomRequest extends Request {
db?: BetterSQLite3Database;
}
import db from '../../db';
export const getConfig = async (req: Request, res: Response, next: NextFunction): Promise<void> => {
try {
const customReq = req as CustomRequest;
const db = customReq.db;
const exitNodeId = req.query.exitNodeId as string;
if (!db) {
throw new Error('Database is not attached to the request');