MCPcopy Create free account
hub / github.com/TomDoesTech/REST-API-Tutorial / connect

Function connect

src/db/connect.ts:5–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import log from "../logger";
4
5function connect() {
6 const dbUri = config.get("dbUri") as string;
7
8 return mongoose
9 .connect(dbUri, {
10 useNewUrlParser: true,
11 useUnifiedTopology: true,
12 })
13 .then(() => {
14 log.info("Database connected");
15 })
16 .catch((error) => {
17 log.error("db error", error);
18 process.exit(1);
19 });
20}
21
22export default connect;

Callers 1

app.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected