Significant API progress
This commit is contained in:
parent
ea72d194c2
commit
01227bb28f
27 changed files with 2378 additions and 0 deletions
16
backend/src/db.ts
Normal file
16
backend/src/db.ts
Normal 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);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue