Significant API progress

This commit is contained in:
oitsjustjose 2022-04-14 20:27:45 -05:00
commit 01227bb28f
27 changed files with 2378 additions and 0 deletions

16
backend/src/db.ts Normal file
View file

@ -0,0 +1,16 @@
import mongoose from "mongoose";
import { LOGGER } from "./app/util/Logger";
export default async () => {
try {
await mongoose.connect(
`mongodb://${process.env.MONGO_URI}/${process.env.MONGO_COLLECTION}`,
{ autoIndex: true }
);
} catch (ex) {
LOGGER.error(
`Failed to connect to Database. Connection failed with error:`
);
process.exit(1);
}
};