style fixes, setup for backend?

This commit is contained in:
2023-07-06 20:05:48 -05:00
parent 32399c2195
commit 598b229689
11 changed files with 73 additions and 40 deletions

3
server/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export default async function main() {
return await Promise.resolve(12);
}

19
server/services/s3.ts Normal file
View File

@@ -0,0 +1,19 @@
import { S3Client } from "@aws-sdk/client-s3";
export default function createS3Client() {
if (typeof process.env.S3_ACCESS_KEY !== "string") {
throw new Error("S3_ACCESS_KEY is not defined");
}
if (typeof process.env.S3_SECRET !== "string") {
throw new Error("S3_SECRET is not defined");
}
return new S3Client({
region: "us-east-1",
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY,
secretAccessKey: process.env.S3_SECRET,
},
});
}

View File

@@ -0,0 +1,13 @@
import { createClient } from "@supabase/supabase-js";
export default function supabaseClient() {
if (typeof process.env.SUPABASE_URL !== "string") {
throw new Error("SUPABASE_URL is not defined");
}
if (typeof process.env.SUPABASE_KEY !== "string") {
throw new Error("SUPABASE_KEY is not defined");
}
return createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY);
}