Files
stocca-tre/server/database.ts
Daniel Ledda c628f6b46e fix: removed collage
fix: removing collage

feat: added ingredient type to server for testing and a config"

chore: setup deno server package
2022-06-21 23:07:01 +02:00

17 lines
512 B
TypeScript

import { Client } from "https://deno.land/x/mysql/mod.ts";
import dbconfig from "./config.json" assert { type: "json" };
export type WithoutId<T> = Omit<T, "id">;
export interface StoccaTreDbConn {
query<T>(query: string): Promise<T>;
}
export default async function createNewDbConnection(): Promise<StoccaTreDbConn> {
return await new Client().connect({
hostname: dbconfig.hostname,
username: dbconfig.username,
db: "stocca_tre",
password: dbconfig.password,
});
}